Areloch 7 лет назад
Родитель
Сommit
ee2ba2111f
100 измененных файлов с 7440 добавлено и 0 удалено
  1. 145 0
      Templates/BaseGame/game/core/Core.cs
  2. 19 0
      Templates/BaseGame/game/core/Core.module
  3. 112 0
      Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs
  4. 9 0
      Templates/BaseGame/game/core/clientServer/Core_ClientServer.module
  5. 29 0
      Templates/BaseGame/game/core/clientServer/scripts/client/client.cs
  6. 130 0
      Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs
  7. 185 0
      Templates/BaseGame/game/core/clientServer/scripts/client/levelDownload.cs
  8. 92 0
      Templates/BaseGame/game/core/clientServer/scripts/client/levelLoad.cs
  9. 94 0
      Templates/BaseGame/game/core/clientServer/scripts/client/message.cs
  10. 40 0
      Templates/BaseGame/game/core/clientServer/scripts/server/audio.cs
  11. 35 0
      Templates/BaseGame/game/core/clientServer/scripts/server/commands.cs
  12. 178 0
      Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs
  13. 62 0
      Templates/BaseGame/game/core/clientServer/scripts/server/defaults.cs
  14. 41 0
      Templates/BaseGame/game/core/clientServer/scripts/server/kickban.cs
  15. 187 0
      Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs
  16. 197 0
      Templates/BaseGame/game/core/clientServer/scripts/server/levelInfo.cs
  17. 181 0
      Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs
  18. 50 0
      Templates/BaseGame/game/core/clientServer/scripts/server/message.cs
  19. 303 0
      Templates/BaseGame/game/core/clientServer/scripts/server/server.cs
  20. 8 0
      Templates/BaseGame/game/core/components/Core_Components.cs
  21. 14 0
      Templates/BaseGame/game/core/components/Core_Components.module
  22. 8 0
      Templates/BaseGame/game/core/components/components/RigidBodyComponent.asset.taml
  23. 8 0
      Templates/BaseGame/game/core/components/components/animationComponent.asset.taml
  24. 8 0
      Templates/BaseGame/game/core/components/components/cameraOrbiterComponent.asset.taml
  25. 8 0
      Templates/BaseGame/game/core/components/components/collisionComponent.asset.taml
  26. 9 0
      Templates/BaseGame/game/core/components/components/game/camera.asset.taml
  27. 185 0
      Templates/BaseGame/game/core/components/components/game/camera.cs
  28. 10 0
      Templates/BaseGame/game/core/components/components/game/controlObject.asset.taml
  29. 89 0
      Templates/BaseGame/game/core/components/components/game/controlObject.cs
  30. 10 0
      Templates/BaseGame/game/core/components/components/game/itemRotate.asset.taml
  31. 49 0
      Templates/BaseGame/game/core/components/components/game/itemRotate.cs
  32. 10 0
      Templates/BaseGame/game/core/components/components/game/playerSpawner.asset.taml
  33. 78 0
      Templates/BaseGame/game/core/components/components/game/playerSpawner.cs
  34. 9 0
      Templates/BaseGame/game/core/components/components/input/fpsControls.asset.taml
  35. 247 0
      Templates/BaseGame/game/core/components/components/input/fpsControls.cs
  36. 82 0
      Templates/BaseGame/game/core/components/components/input/inputManager.cs
  37. 8 0
      Templates/BaseGame/game/core/components/components/meshComponent.asset.taml
  38. 8 0
      Templates/BaseGame/game/core/components/components/playerControllerComponent.asset.taml
  39. 8 0
      Templates/BaseGame/game/core/components/components/soundComponent.asset.taml
  40. 8 0
      Templates/BaseGame/game/core/components/components/stateMachineComponent.asset.taml
  41. 8 0
      Templates/BaseGame/game/core/components/components/triggerComponent.asset.taml
  42. 12 0
      Templates/BaseGame/game/core/console/Core_Console.cs
  43. 10 0
      Templates/BaseGame/game/core/console/Core_Console.module
  44. 191 0
      Templates/BaseGame/game/core/console/guis/console.gui
  45. 137 0
      Templates/BaseGame/game/core/console/scripts/console.cs
  46. 70 0
      Templates/BaseGame/game/core/console/scripts/profiles.cs
  47. BIN
      Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft
  48. BIN
      Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft
  49. BIN
      Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft
  50. BIN
      Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft
  51. BIN
      Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft
  52. BIN
      Templates/BaseGame/game/core/fonts/Arial Bold 14 (ansi).uft
  53. BIN
      Templates/BaseGame/game/core/fonts/Arial Bold 16 (ansi).uft
  54. BIN
      Templates/BaseGame/game/core/fonts/Arial Bold 18 (ansi).uft
  55. BIN
      Templates/BaseGame/game/core/fonts/ArialBold 14 (ansi).uft
  56. BIN
      Templates/BaseGame/game/core/fonts/ArialItalic 14 (ansi).uft
  57. BIN
      Templates/BaseGame/game/core/fonts/Lucida Console 12 (ansi).uft
  58. 11 0
      Templates/BaseGame/game/core/gui/Core_GUI.cs
  59. 10 0
      Templates/BaseGame/game/core/gui/Core_GUI.module
  60. BIN
      Templates/BaseGame/game/core/gui/images/button.png
  61. BIN
      Templates/BaseGame/game/core/gui/images/checkbox.png
  62. BIN
      Templates/BaseGame/game/core/gui/images/group-border.png
  63. BIN
      Templates/BaseGame/game/core/gui/images/inactive-overlay.png
  64. BIN
      Templates/BaseGame/game/core/gui/images/loadingbar.png
  65. BIN
      Templates/BaseGame/game/core/gui/images/scrollBar.png
  66. BIN
      Templates/BaseGame/game/core/gui/images/textEdit.png
  67. BIN
      Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png
  68. BIN
      Templates/BaseGame/game/core/gui/images/window.png
  69. 162 0
      Templates/BaseGame/game/core/gui/scripts/canvas.cs
  70. 102 0
      Templates/BaseGame/game/core/gui/scripts/cursor.cs
  71. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft
  72. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft
  73. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft
  74. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft
  75. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial 36 (ansi).uft
  76. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft
  77. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft
  78. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft
  79. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft
  80. BIN
      Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft
  81. 226 0
      Templates/BaseGame/game/core/gui/scripts/profiles.cs
  82. 20 0
      Templates/BaseGame/game/core/lighting/Core_Lighting.cs
  83. 9 0
      Templates/BaseGame/game/core/lighting/Core_Lighting.module
  84. 68 0
      Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs
  85. 276 0
      Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs
  86. 92 0
      Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs
  87. 76 0
      Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs
  88. 71 0
      Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs
  89. 74 0
      Templates/BaseGame/game/core/lighting/scripts/lighting.cs
  90. 32 0
      Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs
  91. 33 0
      Templates/BaseGame/game/core/postFX/Core_PostFX.cs
  92. 10 0
      Templates/BaseGame/game/core/postFX/Core_PostFX.module
  93. 2755 0
      Templates/BaseGame/game/core/postFX/guis/postFxManager.gui
  94. BIN
      Templates/BaseGame/game/core/postFX/images/AreaMap33.dds
  95. BIN
      Templates/BaseGame/game/core/postFX/images/caustics_1.png
  96. BIN
      Templates/BaseGame/game/core/postFX/images/caustics_2.png
  97. BIN
      Templates/BaseGame/game/core/postFX/images/inactive-overlay.png
  98. 32 0
      Templates/BaseGame/game/core/postFX/images/materials.cs
  99. BIN
      Templates/BaseGame/game/core/postFX/images/missingTexture.png
  100. BIN
      Templates/BaseGame/game/core/postFX/images/noise.png

+ 145 - 0
Templates/BaseGame/game/core/Core.cs

@@ -0,0 +1,145 @@
+
+function CoreModule::onCreate(%this)
+{
+   
+   // ----------------------------------------------------------------------------
+   // Initialize core sub system functionality such as audio, the Canvas, PostFX,
+   // rendermanager, light managers, etc.
+   //
+   // Note that not all of these need to be initialized before the client, although
+   // the audio should and the canvas definitely needs to be.  I've put things here
+   // to distinguish between the purpose and functionality of the various client
+   // scripts.  Game specific script isn't needed until we reach the shell menus
+   // and start a game or connect to a server. We get the various subsystems ready
+   // to go, and then use initClient() to handle the rest of the startup sequence.
+   //
+   // If this is too convoluted we can reduce this complexity after futher testing
+   // to find exactly which subsystems should be readied before kicking things off. 
+   // ----------------------------------------------------------------------------
+   
+   ModuleDatabase.LoadExplicit( "Core_Rendering" );
+   ModuleDatabase.LoadExplicit( "Core_Utility" );
+   ModuleDatabase.LoadExplicit( "Core_GUI" );
+   ModuleDatabase.LoadExplicit( "CoreModule" );
+   ModuleDatabase.LoadExplicit( "Core_Lighting" );
+   ModuleDatabase.LoadExplicit( "Core_SFX" );
+   ModuleDatabase.LoadExplicit( "Core_PostFX" );
+   ModuleDatabase.LoadExplicit( "Core_VR" );
+   ModuleDatabase.LoadExplicit( "Core_VR" );
+   ModuleDatabase.LoadExplicit( "Core_ClientServer" );
+   
+   %prefPath = getPrefpath();
+   if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
+      exec( %prefPath @ "/clientPrefs.cs" );
+   else
+      exec("data/defaults.cs");
+      
+   %der = $pref::Video::displayDevice;
+   
+   //We need to hook the missing/warn material stuff early, so do it here
+   /*$Core::MissingTexturePath = "core/images/missingTexture";
+   $Core::UnAvailableTexturePath = "core/images/unavailable";
+   $Core::WarningTexturePath = "core/images/warnMat";
+   $Core::CommonShaderPath = "core/shaders";
+   
+   /*%classList = enumerateConsoleClasses( "Component" );
+
+   foreach$( %componentClass in %classList )
+   {
+      echo("Native Component of type: " @ %componentClass);
+   }*/
+
+   //exec("./helperFunctions.cs");
+
+   // We need some of the default GUI profiles in order to get the canvas and
+   // other aspects of the GUI system ready.
+   //exec("./profiles.cs");
+
+   //This is a bit of a shortcut, but we'll load the client's default settings to ensure all the prefs get initialized correctly
+   
+
+   // Initialization of the various subsystems requires some of the preferences
+   // to be loaded... so do that first.
+   /*exec("./globals.cs");
+
+   exec("./canvas.cs");
+   exec("./cursor.cs");
+
+   exec("./renderManager.cs");
+   exec("./lighting.cs");
+
+   exec("./audio.cs");
+   exec("./sfx/audioAmbience.cs");
+   exec("./sfx/audioData.cs");
+   exec("./sfx/audioDescriptions.cs");
+   exec("./sfx/audioEnvironments.cs");
+   exec("./sfx/audioStates.cs");
+
+   exec("./parseArgs.cs");
+
+   // Materials and Shaders for rendering various object types
+   exec("./gfxData/commonMaterialData.cs");
+   exec("./gfxData/shaders.cs");
+   exec("./gfxData/terrainBlock.cs");
+   exec("./gfxData/water.cs");
+   exec("./gfxData/scatterSky.cs");
+   exec("./gfxData/clouds.cs");
+
+   // Initialize all core post effects.   
+   exec("./postFx.cs");
+
+   //VR stuff
+   exec("./oculusVR.cs");*/
+
+   // Seed the random number generator.
+   setRandomSeed();
+   
+   // Parse the command line arguments
+   echo("\n--------- Parsing Arguments ---------");
+   parseArgs();
+   
+   // The canvas needs to be initialized before any gui scripts are run since
+   // some of the controls assume that the canvas exists at load time.
+   createCanvas($appName);
+
+   //load canvas
+   //exec("./console/main.cs");
+
+   ModuleDatabase.LoadExplicit( "Core_Console" );
+   
+   // Init the physics plugin.
+   physicsInit();
+
+   sfxStartup();
+
+   // Set up networking.
+   setNetPort(0);
+
+   // Start processing file change events.   
+   startFileChangeNotifications();
+   
+   // If we have editors, initialize them here as well
+   if (isToolBuild())
+   {
+      if(isFile("tools/main.cs") && !$isDedicated)
+         exec("tools/main.cs");
+         
+      ModuleDatabase.scanModules( "tools", false );
+      ModuleDatabase.LoadGroup( "Tools" );
+   }
+}
+
+function CoreModule::onDestroy(%this)
+{
+
+}
+
+//-----------------------------------------------------------------------------
+// Called when the engine is shutting down.
+function onExit() 
+{
+   // Stop file change events.
+   stopFileChangeNotifications();
+   
+   ModuleDatabase.UnloadExplicit( "Game" );
+}

+ 19 - 0
Templates/BaseGame/game/core/Core.module

@@ -0,0 +1,19 @@
+<ModuleDefinition
+	ModuleId="CoreModule"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core">
+	<DeclaredAssets
+           canSave="true"
+           canSaveDynamicFields="true"
+           Extension="asset.taml"
+           Recurse="true" />
+	<AutoloadAssets
+	   canSave="true"
+	   canSaveDynamicFields="true"
+	   AssetType="ComponentAsset"
+	   Recurse="true" />
+</ModuleDefinition>

+ 112 - 0
Templates/BaseGame/game/core/clientServer/Core_ClientServer.cs

@@ -0,0 +1,112 @@
+
+// The general flow of a gane - server's creation, loading and hosting clients, and then destruction is as follows:
+
+// First, a client will always create a server in the event that they want to host a single player
+// game. Torque3D treats even single player connections as a soft multiplayer game, with some stuff
+// in the networking short-circuited to sidestep around lag and packet transmission times.
+
+// initServer() is called, loading the default server scripts.
+// After that, if this is a dedicated server session, initDedicated() is called, otherwise initClient is called
+// to prep a playable client session.
+
+// When a local game is started - a listen server - via calling StartGame() a server is created and then the client is
+// connected to it via createAndConnectToLocalServer().
+
+function Core_ClientServer::create( %this )
+{
+   echo("\n--------- Initializing Directory: scripts ---------");
+   exec( "./scripts/client/client.cs" );
+   exec( "./scripts/server/server.cs" );
+
+   $Game::MissionGroup = "MissionGroup";
+
+   initServer();
+   
+   %dbList = new ArrayObject(DatablockFilesList);
+
+   // Start up in either client, or dedicated server mode
+   if ($Server::Dedicated)
+   {
+      initDedicated();
+   }
+   else
+   {
+      initClient();
+   }
+}
+
+function Core_ClientServer::destroy( %this )
+{
+   // Ensure that we are disconnected and/or the server is destroyed.
+   // This prevents crashes due to the SceneGraph being deleted before
+   // the objects it contains.
+   if ($Server::Dedicated)
+      destroyServer();
+   else
+      disconnect();
+   
+   // Destroy the physics plugin.
+   //physicsDestroy();
+   
+   sfxShutdown();
+      
+   echo("Exporting client prefs");
+   %prefPath = getPrefpath();
+   export("$pref::*", %prefPath @ "/clientPrefs.cs", false);
+
+   echo("Exporting server prefs");
+   export("$Pref::Server::*", %prefPath @ "/serverPrefs.cs", false);
+   BanList::Export(%prefPath @ "/banlist.cs");
+}
+
+//-----------------------------------------------------------------------------
+function StartGame( %mission, %hostingType )
+{
+   if( %mission $= "" )
+   {
+      %id = CL_levelList.getSelectedId();
+      %mission = getField(CL_levelList.getRowTextById(%id), 1);
+      //error("Cannot start a level with no level selected!");
+   }
+
+   if (%hostingType !$= "")
+   {
+      %serverType = %hostingType;
+   }
+   else
+   {
+      if ($pref::HostMultiPlayer)
+         %serverType = "MultiPlayer";
+      else
+         %serverType = "SinglePlayer";
+   }
+
+   // Show the loading screen immediately.
+   if ( isObject( LoadingGui ) )
+   {
+      Canvas.setContent("LoadingGui");
+      LoadingProgress.setValue(1);
+      LoadingProgressTxt.setValue("LOADING MISSION FILE");
+      Canvas.repaint();
+   }
+
+   createAndConnectToLocalServer( %serverType, %mission );
+}
+
+function JoinGame( %serverIndex )
+{
+   // The server info index is stored in the row along with the
+   // rest of displayed info.
+   if( setServerInfo( %serverIndex ) )
+   {
+      Canvas.setContent("LoadingGui");
+      LoadingProgress.setValue(1);
+      LoadingProgressTxt.setValue("WAITING FOR SERVER");
+      Canvas.repaint();
+
+      %conn = new GameConnection(ServerConnection);
+      %conn.setConnectArgs($pref::Player::Name);
+      %conn.setJoinPassword($Client::Password);
+      %conn.connect($ServerInfo::Address);
+   }
+}

+ 9 - 0
Templates/BaseGame/game/core/clientServer/Core_ClientServer.module

@@ -0,0 +1,9 @@
+<ModuleDefinition
+	ModuleId="Core_ClientServer"
+	VersionId="1"
+	Description="Default module for the game."
+	ScriptFile="Core_ClientServer.cs"
+	CreateFunction="create"
+	DestroyFunction="destroy"
+	Group="Core">
+</ModuleDefinition>

+ 29 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/client.cs

@@ -0,0 +1,29 @@
+function initClient()
+{
+   echo("\n--------- Initializing " @ $appName @ ": Client Scripts ---------");
+
+   // Make sure this variable reflects the correct state.
+   $Server::Dedicated = false;
+
+   // Game information used to query the master server
+   $Client::GameTypeQuery = $appName;
+   $Client::MissionTypeQuery = "Any";
+   
+   exec( "./message.cs" );
+   exec( "./connectionToServer.cs" );
+   exec( "./levelDownload.cs" );
+   exec( "./levelLoad.cs" );
+   
+   //load prefs
+   %prefPath = getPrefpath();
+   if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
+      exec( %prefPath @ "/clientPrefs.cs" );
+   else
+      exec( "data/defaults.cs" );
+
+   loadMaterials();
+
+   // Copy saved script prefs into C++ code.
+   setDefaultFov( $pref::Player::defaultFov );
+   setZoomSpeed( $pref::Player::zoomSpeed );
+}

+ 130 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs

@@ -0,0 +1,130 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+// Functions dealing with connecting to a server
+
+//----------------------------------------------------------------------------
+// GameConnection client callbacks
+//----------------------------------------------------------------------------
+// Called on the new connection object after connect() succeeds.
+function GameConnection::onConnectionAccepted(%this)
+{
+   // Startup the physX world on the client before any
+   // datablocks and objects are ghosted over.
+   physicsInitWorld( "client" );   
+}
+
+function GameConnection::initialControlSet(%this)
+{
+   echo ("*** Initial Control Object");
+
+   // The first control object has been set by the server
+   // and we are now ready to go.
+   
+   // first check if the editor is active
+   if (!isToolBuild() || !isMethod("Editor", "checkActiveLoadDone") || !Editor::checkActiveLoadDone())
+   {
+      if (Canvas.getContent() != PlayGui.getId())
+         Canvas.setContent(PlayGui);
+   }
+}
+
+function GameConnection::onControlObjectChange(%this)
+{
+   echo ("*** Control Object Changed");
+   
+   // Reset the current FOV to match the new object
+   // and turn off any current zoom.
+   resetCurrentFOV();
+   turnOffZoom();
+}
+
+function GameConnection::onConnectionError(%this, %msg)
+{
+   // General connection error, usually raised by ghosted objects
+   // initialization problems, such as missing files.  We'll display
+   // the server's connection error message.
+   disconnectedCleanup();
+   MessageBoxOK( "DISCONNECT", $ServerConnectionErrorMessage @ " (" @ %msg @ ")" );
+}
+
+//-----------------------------------------------------------------------------
+// Server connection error
+//-----------------------------------------------------------------------------
+addMessageCallback( 'MsgConnectionError', handleConnectionErrorMessage );
+
+function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
+{
+   // On connect the server transmits a message to display if there
+   // are any problems with the connection.  Most connection errors
+   // are game version differences, so hopefully the server message
+   // will tell us where to get the latest version of the game.
+   $ServerConnectionErrorMessage = %msgError;
+}
+
+//-----------------------------------------------------------------------------
+// Disconnect
+//-----------------------------------------------------------------------------
+
+function disconnect()
+{
+   // We need to stop the client side simulation
+   // else physics resources will not cleanup properly.
+   physicsStopSimulation( "client" );
+
+   // Delete the connection if it's still there.
+   if (isObject(ServerConnection))
+      ServerConnection.delete();
+      
+   disconnectedCleanup();
+
+   // Call destroyServer in case we're hosting
+   destroyServer();
+}
+
+function disconnectedCleanup()
+{
+   // End mission, if it's running.
+   
+   if( $Client::missionRunning )
+      clientEndMission();
+      
+   // Disable mission lighting if it's going, this is here
+   // in case we're disconnected while the mission is loading.
+   
+   $lightingMission = false;
+   $sceneLighting::terminateLighting = true;
+
+   // Back to the launch screen
+   if (isObject( MainMenuGui ))
+      Canvas.setContent( MainMenuGui );
+
+   // Before we destroy the client physics world
+   // make sure all ServerConnection objects are deleted.
+   if(isObject(ServerConnection))
+   {
+      ServerConnection.deleteAllObjects();
+   }
+   
+   // We can now delete the client physics simulation.
+   physicsDestroyWorld( "client" );                 
+}

+ 185 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/levelDownload.cs

@@ -0,0 +1,185 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Mission Loading
+// The client portion of the client/server mission loading process
+//-----------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+// Loading Phases:
+// Phase 1: Transmit Datablocks
+//          Transmit targets
+// Phase 2: Transmit Ghost Objects
+// Phase 3: Start Game
+//
+// The server invokes the client MissionStartPhase[1-3] function to request
+// permission to start each phase.  When a client is ready for a phase,
+// it responds with MissionStartPhase[1-3]Ack.
+
+//----------------------------------------------------------------------------
+// Phase 1 
+//----------------------------------------------------------------------------
+function clientCmdMissionStartPhase1(%seq, %missionName)
+{
+   // These need to come after the cls.
+   echo ("*** New Mission: " @ %missionName);
+   echo ("*** Phase 1: Download Datablocks & Targets");
+   
+   //Prep the postFX stuff
+   // Load the post effect presets for this mission.
+   %path = filePath( %missionName ) @ "/" @ fileBase( %missionName ) @ $PostFXManager::fileExtension;
+
+   if ( isScriptFile( %path ) )
+   {
+      postFXManager::loadPresetHandler( %path ); 
+   }
+   else
+   {
+      PostFXManager::settingsApplyDefaultPreset();
+   }
+   
+   onMissionDownloadPhase("LOADING DATABLOCKS");
+   
+   commandToServer('MissionStartPhase1Ack', %seq);
+}
+
+function onDataBlockObjectReceived(%index, %total)
+{
+   onMissionDownloadProgress(%index / %total);
+}
+
+//----------------------------------------------------------------------------
+// Phase 2
+//----------------------------------------------------------------------------
+function clientCmdMissionStartPhase2(%seq,%missionName)
+{
+   onPhaseComplete();
+   echo ("*** Phase 2: Download Ghost Objects");
+   
+   onMissionDownloadPhase("LOADING OBJECTS");
+   
+   commandToServer('MissionStartPhase2Ack', %seq);
+}
+
+function onGhostAlwaysStarted(%ghostCount)
+{
+   $ghostCount = %ghostCount;
+   $ghostsRecvd = 0;
+}
+
+function onGhostAlwaysObjectReceived()
+{
+   $ghostsRecvd++;
+   onMissionDownloadProgress($ghostsRecvd / $ghostCount);
+}  
+
+//----------------------------------------------------------------------------
+// Phase 3
+//----------------------------------------------------------------------------
+function clientCmdMissionStartPhase3(%seq,%missionName)
+{
+   onPhaseComplete();
+   StartClientReplication();
+   StartFoliageReplication();
+   
+   // Load the static mission decals.
+   if(isFile(%missionName @ ".decals"))
+      decalManagerLoad( %missionName @ ".decals" );
+   
+   echo ("*** Phase 3: Mission Lighting");
+   $MSeq = %seq;
+   $Client::MissionFile = %missionName;
+
+   // Need to light the mission before we are ready.
+   // The sceneLightingComplete function will complete the handshake 
+   // once the scene lighting is done.
+   if (lightScene("sceneLightingComplete", ""))
+   {
+      echo("Lighting mission....");
+      schedule(1, 0, "updateLightingProgress");
+      
+      onMissionDownloadPhase("LIGHTING MISSION");
+      
+      $lightingMission = true;
+   }
+}
+
+function updateLightingProgress()
+{
+   onMissionDownloadProgress($SceneLighting::lightingProgress);
+   if ($lightingMission)
+      $lightingProgressThread = schedule(1, 0, "updateLightingProgress");
+}
+
+function sceneLightingComplete()
+{
+   echo("Mission lighting done");
+   $lightingMission = false;
+   
+   onPhaseComplete("STARTING MISSION");
+   
+   // The is also the end of the mission load cycle.
+   commandToServer('MissionStartPhase3Ack', $MSeq);
+}
+
+//----------------------------------------------------------------------------
+// Helper functions
+//----------------------------------------------------------------------------
+function connect(%server)
+{
+   %conn = new GameConnection(ServerConnection);
+   RootGroup.add(ServerConnection);
+   %conn.setConnectArgs($pref::Player::Name);
+   %conn.setJoinPassword($Client::Password);
+   %conn.connect(%server);
+}
+
+function onMissionDownloadPhase(%phase)
+{
+   if ( !isObject( LoadingProgress ) )
+      return;
+      
+   LoadingProgress.setValue(0);
+   LoadingProgressTxt.setValue(%phase);
+   Canvas.repaint();
+}
+
+function onMissionDownloadProgress(%progress)
+{
+   if ( !isObject( LoadingProgress ) )
+      return;
+      
+   LoadingProgress.setValue(%progress);
+   Canvas.repaint(33);
+}
+
+function onPhaseComplete(%text)
+{
+   if ( !isObject( LoadingProgress ) )
+      return;
+	  
+   if(%text !$= "")
+      LoadingProgressTxt.setValue(%text);
+      
+   LoadingProgress.setValue( 1 );
+   Canvas.repaint();
+}

+ 92 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/levelLoad.cs

@@ -0,0 +1,92 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+// Whether the local client is currently running a mission.
+$Client::missionRunning = false;
+
+// Sequence number for currently running mission.
+$Client::missionSeq = -1;
+
+
+// Called when mission is started.
+function clientStartMission()
+{
+   // The client recieves a mission start right before
+   // being dropped into the game.
+   physicsStartSimulation( "client" );
+   
+   // Start game audio effects channels.
+   
+   AudioChannelEffects.play();
+   
+   // Create client mission cleanup group.
+      
+   new SimGroup( ClientMissionCleanup );
+
+   // Done.
+      
+   $Client::missionRunning = true;
+}
+
+// Called when mission is ended (either through disconnect or
+// mission end client command).
+function clientEndMission()
+{
+   // Stop physics simulation on client.
+   physicsStopSimulation( "client" );
+
+   // Stop game audio effects channels.
+   
+   AudioChannelEffects.stop();
+   
+   // Delete all the decals.
+   decalManagerClear();
+  
+   // Delete client mission cleanup group. 
+   if( isObject( ClientMissionCleanup ) )
+      ClientMissionCleanup.delete();
+      
+   clearClientPaths();
+      
+   // Done.
+   $Client::missionRunning = false;
+}
+
+//----------------------------------------------------------------------------
+// Mission start / end events sent from the server
+//----------------------------------------------------------------------------
+
+function clientCmdMissionStart(%seq)
+{
+   clientStartMission();
+   $Client::missionSeq = %seq;
+}
+
+function clientCmdMissionEnd( %seq )
+{
+   if( $Client::missionRunning && $Client::missionSeq == %seq )
+   {
+      clientEndMission();
+      $Client::missionSeq = -1;
+   }
+}

+ 94 - 0
Templates/BaseGame/game/core/clientServer/scripts/client/message.cs

@@ -0,0 +1,94 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------------
+// Functions that process commands sent from the server.
+
+// Game event descriptions, which may or may not include text messages, can be
+// sent using the message* functions in core/scripts/server/message.cs.  Those
+// functions do commandToClient with the tag ServerMessage, which invokes the
+// function below.
+
+// For ServerMessage messages, the client can install callbacks that will be
+// run, according to the "type" of the message.
+
+function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
+{
+   // Get the message type; terminates at any whitespace.
+   %tag = getWord(%msgType, 0);
+
+   // First see if there is a callback installed that doesn't have a type;
+   // if so, that callback is always executed when a message arrives.
+   for (%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++) {
+      call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
+   }
+
+   // Next look for a callback for this particular type of ServerMessage.
+   if (%tag !$= "") {
+      for (%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++) {
+         call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
+      }
+   }
+}
+
+// Called by the client to install a callback for a particular type of
+// ServerMessage.
+function addMessageCallback(%msgType, %func)
+{
+   for (%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++) {
+      // If it already exists as a callback for this type,
+      // nothing to do.
+      if (%afunc $= %func) {
+         return;
+      }
+   }
+   // Set it up.
+   $MSGCB[%msgType, %i] = %func;
+}
+
+// The following is the callback that will be executed for every ServerMessage,
+// because we're going to install it without a specified type.  Any type-
+// specific callbacks will be executed afterward.
+
+// This just invokes onServerMessage, which can be overridden by the game
+function onServerMessage(%a, %b, %c, %d, %e, %f, %g, %h, %i)
+{
+   echo("onServerMessage: ");
+   if(%a !$= "") echo("  +- a: " @ %a);
+   if(%b !$= "") echo("  +- b: " @ %b);
+   if(%c !$= "") echo("  +- c: " @ %c);
+   if(%d !$= "") echo("  +- d: " @ %d);
+   if(%e !$= "") echo("  +- e: " @ %e);
+   if(%f !$= "") echo("  +- f: " @ %f);
+   if(%g !$= "") echo("  +- g: " @ %g);
+   if(%h !$= "") echo("  +- h: " @ %h);
+   if(%i !$= "") echo("  +- i: " @ %i);
+}
+
+function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
+{
+   onServerMessage(detag(%msgString));
+}
+
+// Register that default message handler now.
+addMessageCallback("", defaultMessageCallback);

+ 40 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/audio.cs

@@ -0,0 +1,40 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+
+function ServerPlay2D(%profile)
+{
+   // Play the given sound profile on every client.
+   // The sounds will be transmitted as an event, not attached to any object.
+   for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
+      ClientGroup.getObject(%idx).play2D(%profile);
+}
+
+function ServerPlay3D(%profile,%transform)
+{
+   // Play the given sound profile at the given position on every client
+   // The sound will be transmitted as an event, not attached to any object.
+   for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
+      ClientGroup.getObject(%idx).play3D(%profile,%transform);
+}
+

+ 35 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/commands.cs

@@ -0,0 +1,35 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Misc. server commands avialable to clients
+//-----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+// Debug commands
+//----------------------------------------------------------------------------
+
+function serverCmdNetSimulateLag( %client, %msDelay, %packetLossPercent )
+{
+   if ( %client.isAdmin )
+      %client.setSimulatedNetParams( %packetLossPercent / 100.0, %msDelay );   
+}

+ 178 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs

@@ -0,0 +1,178 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------------
+// This script function is called before a client connection
+// is accepted.  Returning "" will accept the connection,
+// anything else will be sent back as an error to the client.
+// All the connect args are passed also to onConnectRequest
+//
+function GameConnection::onConnectRequest( %client, %netAddress, %name )
+{
+   echo("Connect request from: " @ %netAddress);
+   if($Server::PlayerCount >= $pref::Server::MaxPlayers)
+      return "CR_SERVERFULL";
+   return "";
+}
+
+//-----------------------------------------------------------------------------
+// This script function is the first called on a client accept
+function GameConnection::onConnect( %this, %clientData )
+{
+   // Send down the connection error info, the client is responsible for
+	// displaying this message if a connection error occurs.
+	messageClient(%this, 'MsgConnectionError', "", $Pref::Server::ConnectionError);
+	
+	// Send mission information to the client
+	sendLoadInfoToClient(%this);
+	
+	// Simulated client lag for testing...
+	// %client.setSimulatedNetParams(0.1, 30);
+	
+	// Get the client's unique id:
+	// %authInfo = %client.getAuthInfo();
+	// %client.guid = getField(%authInfo, 3);
+	%this.guid = 0;
+	addToServerGuidList(%this.guid);
+	
+	// Set admin status
+	if (%this.getAddress() $= "local")
+	{
+		%this.isAdmin = true;
+		%this.isSuperAdmin = true;
+	}
+	else
+	{
+		%this.isAdmin = false;
+		%this.isSuperAdmin = false;
+	}
+	
+	echo("CADD: "@ %this @" "@ %this.getAddress());
+
+	// If the mission is running, go ahead download it to the client
+	if ($missionRunning)
+	{
+		%this.loadMission();
+	}
+	else if ($Server::LoadFailMsg !$= "")
+	{
+		messageClient(%this, 'MsgLoadFailed', $Server::LoadFailMsg);
+	}
+	
+	%this.connectData = %clientData;
+	
+	$Server::PlayerCount++;
+}
+
+//-----------------------------------------------------------------------------
+// A player's name could be obtained from the auth server, but for
+// now we use the one passed from the client.
+// %realName = getField( %authInfo, 0 );
+//
+function GameConnection::setPlayerName(%client,%name)
+{
+   %client.sendGuid = 0;
+
+   // Minimum length requirements
+   %name = trim( strToPlayerName( %name ) );
+   if ( strlen( %name ) < 3 )
+      %name = "Poser";
+
+   // Make sure the alias is unique, we'll hit something eventually
+   if (!isNameUnique(%name))
+   {
+      %isUnique = false;
+      for (%suffix = 1; !%isUnique; %suffix++)  {
+         %nameTry = %name @ "." @ %suffix;
+         %isUnique = isNameUnique(%nameTry);
+      }
+      %name = %nameTry;
+   }
+
+   // Tag the name with the "smurf" color:
+   %client.nameBase = %name;
+   %client.playerName = addTaggedString("\cp\c8" @ %name @ "\co");
+}
+
+function isNameUnique(%name)
+{
+   %count = ClientGroup.getCount();
+   for ( %i = 0; %i < %count; %i++ )
+   {
+      %test = ClientGroup.getObject( %i );
+      %rawName = stripChars( detag( getTaggedString( %test.playerName ) ), "\cp\co\c6\c7\c8\c9" );
+      if ( strcmp( %name, %rawName ) == 0 )
+         return false;
+   }
+   return true;
+}
+
+//-----------------------------------------------------------------------------
+// This function is called when a client drops for any reason
+//
+function GameConnection::onDrop(%client, %reason)
+{
+   %entityIds = parseMissionGroupForIds("Entity", "");
+   %entityCount = getWordCount(%entityIds);
+   
+   for(%i=0; %i < %entityCount; %i++)
+   {
+      %entity = getWord(%entityIds, %i);
+      
+      for(%e=0; %e < %entity.getCount(); %e++)
+      {
+         %child = %entity.getObject(%e);
+         if(%child.getClassName() $= "Entity")
+            %entityIds = %entityIds SPC %child.getID();  
+      }
+      
+      %entity.notify("onClientDisconnect", %client);
+   }
+   
+   if($missionRunning)
+      theLevelInfo.onClientLeaveGame();
+   
+   removeFromServerGuidList( %client.guid );
+
+   $Server::PlayerCount--;
+}
+
+//-----------------------------------------------------------------------------
+
+function GameConnection::startMission(%this)
+{
+   // Inform the client the mission starting
+   commandToClient(%this, 'MissionStart', $missionSequence);
+}
+
+
+function GameConnection::endMission(%this)
+{
+   // Inform the client the mission is done.  Note that if this is
+   // called as part of the server destruction routine, the client will
+   // actually never see this comment since the client connection will
+   // be destroyed before another round of command processing occurs.
+   // In this case, the client will only see the disconnect from the server
+   // and should manually trigger a mission cleanup.
+   commandToClient(%this, 'MissionEnd', $missionSequence);
+}

+ 62 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/defaults.cs

@@ -0,0 +1,62 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//Firstly, set up our standard server prefs
+
+// List of master servers to query, each one is tried in order
+// until one responds
+$Pref::Server::RegionMask = 2;
+$pref::Master[0] = "2:master.garagegames.com:28002";
+
+// Information about the server
+$Pref::Server::Name = "Torque 3D Server";
+$Pref::Server::Info = "This is a Torque 3D server.";
+
+// The connection error message is transmitted to the client immediatly
+// on connection, if any further error occures during the connection
+// process, such as network traffic mismatch, or missing files, this error
+// message is display. This message should be replaced with information
+// usefull to the client, such as the url or ftp address of where the
+// latest version of the game can be obtained.
+$Pref::Server::ConnectionError =
+   "You do not have the correct version of "@$appName@" or "@
+   "the related art needed to play on this server, please contact "@
+   "the server administrator.";
+
+// The network port is also defined by the client, this value 
+// overrides pref::net::port for dedicated servers
+$Pref::Server::Port = 28000;
+
+// If the password is set, clients must provide it in order
+// to connect to the server
+$Pref::Server::Password = "";
+
+// Password for admin clients
+$Pref::Server::AdminPassword = "";
+
+// Misc server settings.
+$Pref::Server::MaxPlayers = 64;
+$Pref::Server::TimeLimit = 20;               // In minutes
+$Pref::Server::KickBanTime = 300;            // specified in seconds
+$Pref::Server::BanTime = 1800;               // specified in seconds
+$Pref::Server::FloodProtectionEnabled = 1;
+$Pref::Server::MaxChatLen = 120;

+ 41 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/kickban.cs

@@ -0,0 +1,41 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+
+function kick(%client)
+{
+   messageAll( 'MsgAdminForce', '\c2The Admin has kicked %1.', %client.playerName);
+
+   if (!%client.isAIControlled())
+      BanList::add(%client.guid, %client.getAddress(), $Pref::Server::KickBanTime);
+   %client.delete("You have been kicked from this server");
+}
+
+function ban(%client)
+{
+   messageAll('MsgAdminForce', '\c2The Admin has banned %1.', %client.playerName);
+
+   if (!%client.isAIControlled())
+      BanList::add(%client.guid, %client.getAddress(), $Pref::Server::BanTime);
+   %client.delete("You have been banned from this server");
+}

+ 187 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs

@@ -0,0 +1,187 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Mission Loading
+// The server portion of the client/server mission loading process
+//-----------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+// Loading Phases:
+// Phase 1: Transmit Datablocks
+//          Transmit targets
+// Phase 2: Transmit Ghost Objects
+// Phase 3: Start Game
+//
+// The server invokes the client MissionStartPhase[1-3] function to request
+// permission to start each phase.  When a client is ready for a phase,
+// it responds with MissionStartPhase[1-3]Ack.
+
+//----------------------------------------------------------------------------
+// Phase 1 
+//----------------------------------------------------------------------------
+function GameConnection::loadMission(%this)
+{
+   // Send over the information that will display the server info
+   // when we learn it got there, we'll send the data blocks
+   %this.currentPhase = 0;
+   if (%this.isAIControlled())
+   {
+      // Cut to the chase...
+      theLevelInfo.onEnterGame(%this);
+   }
+   else
+   {
+      commandToClient(%this, 'MissionStartPhase1', $missionSequence, $Server::MissionFile);
+         
+      echo("*** Sending mission load to client: " @ $Server::MissionFile);
+   }
+}
+
+function serverCmdMissionStartPhase1Ack(%client, %seq)
+{
+   // Make sure to ignore calls from a previous mission load
+   if (%seq != $missionSequence || !$MissionRunning || %client.currentPhase != 0)
+      return;
+
+   %client.currentPhase = 1;
+
+   // Start with the CRC
+   %client.setMissionCRC( $missionCRC );
+
+   // Send over the datablocks...
+   // OnDataBlocksDone will get called when have confirmation
+   // that they've all been received.
+   %client.transmitDataBlocks($missionSequence);
+}
+
+function GameConnection::onDataBlocksDone( %this, %missionSequence )
+{
+   // Make sure to ignore calls from a previous mission load
+   if (%missionSequence != $missionSequence || %this.currentPhase != 1)
+      return;
+
+   %this.currentPhase = 1.5;
+
+   // On to the next phase
+   commandToClient(%this, 'MissionStartPhase2', $missionSequence, $Server::MissionFile);
+}
+
+//----------------------------------------------------------------------------
+// Phase 2
+//----------------------------------------------------------------------------
+function serverCmdMissionStartPhase2Ack(%client, %seq)
+{
+   // Make sure to ignore calls from a previous mission load
+   if (%seq != $missionSequence || !$MissionRunning || %client.currentPhase != 1.5)
+      return;
+
+   %client.currentPhase = 2;
+   
+   // Update mod paths, this needs to get there before the objects.
+   %client.transmitPaths();
+
+   // Start ghosting objects to the client
+   %client.activateGhosting();
+}
+
+function GameConnection::clientWantsGhostAlwaysRetry(%client)
+{
+   if($MissionRunning)
+      %client.activateGhosting();
+}
+
+function GameConnection::onGhostAlwaysFailed(%client)
+{
+}
+
+function GameConnection::onGhostAlwaysObjectsReceived(%client)
+{
+   // Ready for next phase.
+   commandToClient(%client, 'MissionStartPhase3', $missionSequence, $Server::MissionFile);
+}
+
+//----------------------------------------------------------------------------
+// Phase 3
+//----------------------------------------------------------------------------
+function serverCmdMissionStartPhase3Ack(%client, %seq)
+{
+   // Make sure to ignore calls from a previous mission load
+   if(%seq != $missionSequence || !$MissionRunning || %client.currentPhase != 2)
+      return;
+
+   %client.currentPhase = 3;
+   
+   // Server is ready to drop into the game
+   %entityIds = parseMissionGroupForIds("Entity", "");
+   %entityCount = getWordCount(%entityIds);
+   
+   for(%i=0; %i < %entityCount; %i++)
+   {
+      %entity = getWord(%entityIds, %i);
+      
+      for(%e=0; %e < %entity.getCount(); %e++)
+      {
+         %child = %entity.getObject(%e);
+         if(%child.getCLassName() $= "Entity")
+            %entityIds = %entityIds SPC %child.getID();  
+      }
+      
+      %entity.notify("onClientConnect", %client);
+   }
+   
+   //Have any special game-play handling here
+   if(theLevelInfo.isMethod("onClientEnterGame"))
+   {
+      theLevelInfo.onClientEnterGame(%client);
+   }
+   else
+   {
+      //No Game mode class for the level info, so just spawn a default camera
+      // Set the control object to the default camera
+      if (!isObject(%client.camera))
+      {
+         if(!isObject(Observer))
+         {
+            datablock CameraData(Observer)
+            {
+               mode = "Observer";
+            };  
+         }
+         
+         //if (isDefined("$Game::DefaultCameraClass"))
+            %client.camera = spawnObject("Camera", Observer);
+      }
+
+      // If we have a camera then set up some properties
+      if (isObject(%client.camera))
+      {
+         MissionCleanup.add( %this.camera );
+         %client.camera.scopeToClient(%client);
+
+         %client.setControlObject(%client.camera);
+
+         %client.camera.setTransform("0 0 1 0 0 0 0");
+      }
+   }
+   
+   %client.startMission();
+}

+ 197 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/levelInfo.cs

@@ -0,0 +1,197 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// Loading info is text displayed on the client side while the mission
+// is being loaded.  This information is extracted from the mission file
+// and sent to each the client as it joins.
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// clearLoadInfo
+//
+// Clears the mission info stored
+//------------------------------------------------------------------------------
+function clearLoadInfo() 
+{
+   if (isObject(theLevelInfo))
+      theLevelInfo.delete();
+}
+
+//------------------------------------------------------------------------------
+// buildLoadInfo
+//
+// Extract the map description from the .mis file
+//------------------------------------------------------------------------------
+function buildLoadInfo( %mission ) 
+{
+	clearLoadInfo();
+
+	%infoObject = "";
+	%file = new FileObject();
+
+	if ( %file.openForRead( %mission ) ) {
+		%inInfoBlock = false;
+		
+		while ( !%file.isEOF() ) {
+			%line = %file.readLine();
+			%line = trim( %line );
+			
+			if( %line $= "new ScriptObject(MissionInfo) {" )
+				%inInfoBlock = true;
+         else if( %line $= "new LevelInfo(theLevelInfo) {" )
+				%inInfoBlock = true;
+			else if( %inInfoBlock && %line $= "};" ) {
+				%inInfoBlock = false;
+				%infoObject = %infoObject @ %line; 
+				break;
+			}
+			
+			if( %inInfoBlock )
+			   %infoObject = %infoObject @ %line @ " ";
+		}
+		
+		%file.close();
+	}
+	else
+	   error("Level file " @ %mission @ " not found.");
+
+   // Will create the object "MissionInfo"
+	eval( %infoObject );
+	%file.delete();
+}
+
+//------------------------------------------------------------------------------
+// dumpLoadInfo
+//
+// Echo the mission information to the console
+//------------------------------------------------------------------------------
+function dumpLoadInfo()
+{
+	echo( "Level Name: " @ theLevelInfo.name );
+   echo( "Level Description:" );
+   
+   for( %i = 0; theLevelInfo.desc[%i] !$= ""; %i++ )
+      echo ("   " @ theLevelInfo.desc[%i]);
+}
+
+//------------------------------------------------------------------------------
+// sendLoadInfoToClient
+//
+// Sends mission description to the client
+//------------------------------------------------------------------------------
+function sendLoadInfoToClient( %client )
+{
+   messageClient( %client, 'MsgLoadInfo', "", theLevelInfo.levelName );
+
+   // Send Mission Description a line at a time
+   for( %i = 0; theLevelInfo.desc[%i] !$= ""; %i++ )
+     messageClient( %client, 'MsgLoadDescripition', "", theLevelInfo.desc[%i] );
+
+   messageClient( %client, 'MsgLoadInfoDone' );
+}
+
+// A function used in order to easily parse the MissionGroup for classes . I'm pretty 
+// sure at this point the function can be easily modified to search the any group as well.
+function parseMissionGroup( %className, %childGroup )
+{
+   if( getWordCount( %childGroup ) == 0)
+      %currentGroup = "MissionGroup";
+   else
+      %currentGroup = %childGroup;
+      
+   for(%i = 0; %i < (%currentGroup).getCount(); %i++)
+   {      
+      if( (%currentGroup).getObject(%i).getClassName() $= %className )
+         return true;
+      
+      if( (%currentGroup).getObject(%i).getClassName() $= "SimGroup" )
+      {
+         if( parseMissionGroup( %className, (%currentGroup).getObject(%i).getId() ) )
+            return true;         
+      }
+   } 
+}
+
+//
+function parseMissionGroupForIds( %className, %childGroup )
+{
+   if( getWordCount( %childGroup ) == 0)
+      %currentGroup = $Game::MissionGroup;
+   else
+      %currentGroup = %childGroup;
+      
+   for(%i = 0; %i < (%currentGroup).getCount(); %i++)
+   {      
+      if( (%currentGroup).getObject(%i).getClassName() $= %className )
+         %classIds = %classIds @ (%currentGroup).getObject(%i).getId() @ " ";
+      
+      if( (%currentGroup).getObject(%i).getClassName() $= "SimGroup" )
+         %classIds = %classIds @ parseMissionGroupForIds( %className, (%currentGroup).getObject(%i).getId());
+   } 
+   return %classIds;
+}
+
+function getLevelInfo( %missionFile ) 
+{
+   clearLoadInfo();
+   
+   %file = new FileObject();
+   
+   %LevelInfoObject = "";
+   
+   if ( %file.openForRead( %missionFile ) ) {
+		%inInfoBlock = false;
+		
+		while ( !%file.isEOF() ) {
+			%line = %file.readLine();
+			%line = trim( %line );
+			
+			if( %line $= "new ScriptObject(LevelInfo) {" )
+				%inInfoBlock = true;
+         else if( %line $= "new LevelInfo(theLevelInfo) {" )
+				%inInfoBlock = true;
+			else if( %inInfoBlock && %line $= "};" ) {
+				%inInfoBlock = false;
+				%LevelInfoObject = %LevelInfoObject @ %line; 
+				break;
+			}
+			
+			if( %inInfoBlock )
+			   %LevelInfoObject = %LevelInfoObject @ %line @ " "; 	
+		}
+		
+		%file.close();
+	}
+   %file.delete();
+
+	if( %LevelInfoObject !$= "" )
+	{
+	   %LevelInfoObject = "%LevelInfoObject = " @ %LevelInfoObject;
+	   eval( %LevelInfoObject );
+
+      return %LevelInfoObject;
+	}
+	
+	// Didn't find our LevelInfo
+   return 0; 
+}

+ 181 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs

@@ -0,0 +1,181 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Mission Loading
+// The server portion of the client/server mission loading process
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// Server mission loading
+//-----------------------------------------------------------------------------
+// On every mission load except the first, there is a pause after
+// the initial mission info is downloaded to the client.
+$MissionLoadPause = 5000;
+
+//-----------------------------------------------------------------------------
+//This is the first call made by the server to kick the loading process off
+function loadMission( %missionName, %isFirstMission ) 
+{
+   endMission();
+   echo("*** LOADING MISSION: " @ %missionName);
+   echo("*** Stage 1 load");
+
+   // increment the mission sequence (used for ghost sequencing)
+   $missionSequence++;
+   $missionRunning = false;
+   $Server::MissionFile = %missionName;
+   $Server::LoadFailMsg = "";
+
+   // Extract mission info from the mission file,
+   // including the display name and stuff to send
+   // to the client.
+   buildLoadInfo( %missionName );
+
+   // Download mission info to the clients
+   %count = ClientGroup.getCount();
+   for( %cl = 0; %cl < %count; %cl++ ) 
+   {
+      %client = ClientGroup.getObject( %cl );
+      
+      if (!%client.isAIControlled())
+         sendLoadInfoToClient(%client);
+   }
+
+   // Now that we've sent the LevelInfo to the clients
+   // clear it so that it won't conflict with the actual
+   // LevelInfo loaded in the level
+   clearLoadInfo();
+
+   // if this isn't the first mission, allow some time for the server
+   // to transmit information to the clients:
+   if( %isFirstMission || $Server::ServerType $= "SinglePlayer" )
+      loadMissionStage2();
+   else
+      schedule( $MissionLoadPause, ServerGroup, loadMissionStage2 );
+}
+
+//-----------------------------------------------------------------------------
+
+function loadMissionStage2() 
+{
+   echo("*** Stage 2 load");
+
+   // Create the mission group off the ServerGroup
+   $instantGroup = ServerGroup;
+
+   // Make sure the mission exists
+   %file = $Server::MissionFile;
+   
+   if( !isFile( %file ) )
+   {
+      $Server::LoadFailMsg = "Could not find mission \"" @ %file @ "\"";
+   }
+   else
+   {
+      // Calculate the mission CRC.  The CRC is used by the clients
+      // to caching mission lighting.
+      $missionCRC = getFileCRC( %file );
+
+      // Exec the mission.  The MissionGroup (loaded components) is added to the ServerGroup
+      exec(%file);
+
+      if( !isObject(MissionGroup) )
+      {
+         $Server::LoadFailMsg = "No 'MissionGroup' found in mission \"" @ %file @ "\".";
+      }
+   }
+
+   if( $Server::LoadFailMsg !$= "" )
+   {
+      // Inform clients that are already connected
+      for (%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++)
+         messageClient(ClientGroup.getObject(%clientIndex), 'MsgLoadFailed', $Server::LoadFailMsg);    
+      return;
+   }
+
+   // Set mission name.
+   if( isObject( theLevelInfo ) )
+      $Server::MissionName = theLevelInfo.levelName;
+
+   // Mission cleanup group.  This is where run time components will reside.  The MissionCleanup
+   // group will be added to the ServerGroup.
+   new SimGroup( MissionCleanup );
+
+   // Make the MissionCleanup group the place where all new objects will automatically be added.
+   $instantGroup = MissionCleanup;
+   
+   // Construct MOD paths
+   pathOnMissionLoadDone();
+
+   // Mission loading done...
+   echo("*** Mission loaded");
+
+   // Start all the clients in the mission
+   $missionRunning = true;
+   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
+      ClientGroup.getObject(%clientIndex).loadMission();
+
+   // Go ahead and launch the game
+   if(TheLevelInfo.isMethod("onMissionStart"))
+      TheLevelInfo.onMissionStart();
+}
+
+function endMission()
+{
+   if (!isObject( MissionGroup ))
+      return;
+
+   echo("*** ENDING MISSION");
+   
+   // Inform the game code we're done.
+   TheLevelInfo.onMissionEnded();
+
+   // Inform the clients
+   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
+      // clear ghosts and paths from all clients
+      %cl = ClientGroup.getObject( %clientIndex );
+      %cl.endMission();
+      %cl.resetGhosting();
+      %cl.clearPaths();
+   }
+   
+   // Delete everything
+   MissionGroup.delete();
+   MissionCleanup.delete();
+   
+   clearServerPaths();
+}
+
+function resetMission()
+{
+   echo("*** MISSION RESET");
+
+   // Remove any temporary mission objects
+   MissionCleanup.delete();
+   $instantGroup = ServerGroup;
+   new SimGroup( MissionCleanup );
+   $instantGroup = MissionCleanup;
+
+   clearServerPaths();
+   //
+   TheLevelInfo.onMissionReset();
+}

+ 50 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/message.cs

@@ -0,0 +1,50 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
+{
+   commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
+}
+
+function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
+{
+   %count = ClientGroup.getCount();
+   for(%cl = 0; %cl < %count; %cl++)
+   {
+      %client = ClientGroup.getObject(%cl);
+      messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
+   }
+}
+
+function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
+{  
+   //can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
+   //messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
+   %count = ClientGroup.getCount();
+   for(%cl= 0; %cl < %count; %cl++)
+   {
+      %recipient = ClientGroup.getObject(%cl);
+      if((%recipient != %client) && (%recipient.team != %team))
+         messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
+   }
+}

+ 303 - 0
Templates/BaseGame/game/core/clientServer/scripts/server/server.cs

@@ -0,0 +1,303 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function initServer()
+{
+   echo("\n--------- Initializing " @ $appName @ ": Server Scripts ---------");
+   
+   //load prefs
+
+   //Force-load the defaults just so we don't have any mistakes
+   exec( "./defaults.cs" );   
+   
+   //Then, if the user has saved preferences, we load those over-top the defaults
+   %prefPath = getPrefpath();
+   if ( isFile( %prefPath @ "/serverPrefs.cs" ) )
+      exec( %prefPath @ "/serverPrefs.cs" );
+   
+   exec( "./audio.cs" );
+   exec( "./commands.cs" );
+   exec( "./kickban.cs" );
+   exec( "./message.cs" );
+   exec( "./levelDownload.cs" );
+   exec( "./levelLoad.cs" );
+   exec( "./levelInfo.cs" );
+   exec( "./connectionToClient.cs" );
+
+   // Server::Status is returned in the Game Info Query and represents the
+   // current status of the server. This string sould be very short.
+   $Server::Status = "Unknown";
+
+   // Turn on testing/debug script functions
+   $Server::TestCheats = false;
+
+   // Specify where the mission files are.
+   $Server::MissionFileSpec = "data/levels/*.mis";
+}
+
+//-----------------------------------------------------------------------------
+function initDedicated()
+{
+   enableWinConsole(true);
+   echo("\n--------- Starting Dedicated Server ---------");
+
+   // Make sure this variable reflects the correct state.
+   $Server::Dedicated = true;
+
+   // The server isn't started unless a mission has been specified.
+   if ($missionArg !$= "") {
+      createServer("MultiPlayer", $missionArg);
+   }
+   else
+      echo("No mission specified (use -mission filename)");
+}
+
+/// Attempt to find an open port to initialize the server with
+function portInit(%port)
+{
+   %failCount = 0;
+   while(%failCount < 10 && !setNetPort(%port))
+   {
+      echo("Port init failed on port " @ %port @ " trying next port.");
+      %port++; %failCount++;
+   }
+}
+
+/// Create a server of the given type, load the given level, and then
+/// create a local client connection to the server.
+//
+/// @return true if successful.
+function createAndConnectToLocalServer( %serverType, %level )
+{
+   if( !createServer( %serverType, %level ) )
+      return false;
+   
+   %conn = new GameConnection( ServerConnection );
+   RootGroup.add( ServerConnection );
+   
+   %conn.setConnectArgs( $pref::Player::Name );
+   %conn.setJoinPassword( $Client::Password );
+   
+   %result = %conn.connectLocal();
+   if( %result !$= "" )
+   {
+      %conn.delete();
+      destroyServer();
+         
+      MessageBoxOK("Error starting local server!", "There was an error when trying to connect to the local server.");
+      
+      if(isObject(MainMenuGui))
+         Canvas.setContent(MainMenuGui);
+      
+      return false;
+   }
+   
+   return true;
+}
+
+/// Create a server with either a "SinglePlayer" or "MultiPlayer" type
+/// Specify the level to load on the server
+function createServer(%serverType, %level)
+{
+   // Increase the server session number.  This is used to make sure we're
+   // working with the server session we think we are.
+   $Server::Session++;
+   
+   if (%level $= "")
+   {
+      error("createServer(): level name unspecified");
+      return false;
+   }
+   
+   // Make sure our level name is relative so that it can send
+   // across the network correctly
+   %level = makeRelativePath(%level, getWorkingDirectory());
+
+   destroyServer();
+
+   $missionSequence = 0;
+   $Server::PlayerCount = 0;
+   $Server::ServerType = %serverType;
+   $Server::LoadFailMsg = "";
+   $Physics::isSinglePlayer = true;
+   
+   // Setup for multi-player, the network must have been
+   // initialized before now.
+   if (%serverType $= "MultiPlayer")
+   {
+      $Physics::isSinglePlayer = false;
+            
+      echo("Starting multiplayer mode");
+
+      // Make sure the network port is set to the correct pref.
+      portInit($Pref::Server::Port);
+      allowConnections(true);
+
+      if ($pref::Net::DisplayOnMaster !$= "Never" )
+         schedule(0,0,startHeartbeat);
+   }
+
+   // Let the game initialize some things now that the
+   // the server has been created
+   onServerCreated();
+
+   loadMission(%level, true);
+   
+   $Game::running = true;
+   
+   return true;
+}
+
+function onServerCreated()
+{
+   // Server::GameType is sent to the master server.
+   // This variable should uniquely identify your game and/or mod.
+   $Server::GameType = $appName;
+
+   // Server::MissionType sent to the master server.  Clients can
+   // filter servers based on mission type.
+  // $Server::MissionType = "Deathmatch";
+
+   // GameStartTime is the sim time the game started. Used to calculated
+   // game elapsed time.
+   $Game::StartTime = 0;
+
+   // Create the server physics world.
+   physicsInitWorld( "server" );
+
+   physicsStartSimulation("server");
+   
+   %cnt = DatablockFilesList.count();
+
+   loadDatablockFiles( DatablockFilesList, true );
+   
+   %cnt = DatablockFilesList.count();
+   
+   // Keep track of when the game started
+   $Game::StartTime = $Sim::Time;
+}
+
+/// Shut down the server
+function destroyServer()
+{
+   $Server::ServerType = "";
+   $Server::Running = false;
+   
+   allowConnections(false);
+   stopHeartbeat();
+   $missionRunning = false;
+   
+   // End any running levels and shut down the physics sim
+   onServerDestroyed();
+
+   //physicsDestroy();
+
+   // Delete all the server objects
+   if (isObject(ServerGroup))
+      ServerGroup.delete();
+
+   // Delete all the connections:
+   while (ClientGroup.getCount())
+   {
+      %client = ClientGroup.getObject(0);
+      %client.delete();
+   }
+
+   $Server::GuidList = "";
+
+   // Delete all the data blocks...
+   deleteDataBlocks();
+   
+   // Save any server settings
+   %prefPath = getPrefpath();
+   echo( "Exporting server prefs..." );
+   export( "$Pref::Server::*", %prefPath@"/serverPrefs.cs", false );
+   
+   BanList::Export(%prefPath@"/banlist.cs");
+
+   // Increase the server session number.  This is used to make sure we're
+   // working with the server session we think we are.
+   $Server::Session++;
+}
+
+function onServerDestroyed()
+{
+   physicsStopSimulation("server");
+   
+   if (!isObject( MissionGroup ))
+      return;
+
+   echo("*** ENDING MISSION");
+   
+   // Inform the game code we're done.
+   if(TheLevelInfo.isMethod("onMissionEnded"))
+      TheLevelInfo.onMissionEnded();
+
+   // Inform the clients
+   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
+      // clear ghosts and paths from all clients
+      %cl = ClientGroup.getObject( %clientIndex );
+      %cl.endMission();
+      %cl.resetGhosting();
+      %cl.clearPaths();
+   }
+   
+   // Delete everything
+   MissionGroup.delete();
+   MissionCleanup.delete();
+   
+   clearServerPaths();
+}
+
+/// Guid list maintenance functions
+function addToServerGuidList( %guid )
+{
+   %count = getFieldCount( $Server::GuidList );
+   for ( %i = 0; %i < %count; %i++ )
+   {
+      if ( getField( $Server::GuidList, %i ) == %guid )
+         return;
+   }
+
+   $Server::GuidList = $Server::GuidList $= "" ? %guid : $Server::GuidList TAB %guid;
+}
+
+function removeFromServerGuidList( %guid )
+{
+   %count = getFieldCount( $Server::GuidList );
+   for ( %i = 0; %i < %count; %i++ )
+   {
+      if ( getField( $Server::GuidList, %i ) == %guid )
+      {
+         $Server::GuidList = removeField( $Server::GuidList, %i );
+         return;
+      }
+   }
+}
+
+/// When the server is queried for information, the value of this function is
+/// returned as the status field of the query packet.  This information is
+/// accessible as the ServerInfo::State variable.
+function onServerInfoQuery()
+{
+   return "Doing Ok";
+}

+ 8 - 0
Templates/BaseGame/game/core/components/Core_Components.cs

@@ -0,0 +1,8 @@
+
+function Core_Components::onCreate(%this)
+{
+}
+
+function Core_Components::onDestroy(%this)
+{
+}

+ 14 - 0
Templates/BaseGame/game/core/components/Core_Components.module

@@ -0,0 +1,14 @@
+<ModuleDefinition
+	ModuleId="Core_Components"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core_Components.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core">
+	<DeclaredAssets
+           canSave="true"
+           canSaveDynamicFields="true"
+           Extension="asset.taml"
+           Recurse="true" />
+</ModuleDefinition>

+ 8 - 0
Templates/BaseGame/game/core/components/components/RigidBodyComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="RigidBodyComponentAsset"
+    componentClass="RigidBodyComponent"
+    friendlyName="Rigid Body"
+    componentType="Physics"
+    description="Allows an entity to have rigid body physics." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/animationComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="AnimationComponentAsset"
+    componentClass="AnimationComponent"
+    friendlyName="animation"
+    componentType="animation"
+    description="Allows a mesh component to be animated." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/cameraOrbiterComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="CameraOrbiterComponentAsset"
+    componentClass="CameraOrbiterComponent"
+    friendlyName="Camera Orbiter"
+    componentType="Game"
+    description="Acts as a boon arm for a camera component." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/collisionComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="ShapeCollisionComponentAsset"
+    componentClass="ShapeCollisionComponent"
+    friendlyName="Shape Collision"
+    componentType="Collision"
+    description="Enables an entity to collide with things with bounds, collision or visible meshes" />

+ 9 - 0
Templates/BaseGame/game/core/components/components/game/camera.asset.taml

@@ -0,0 +1,9 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="CameraComponentAsset"
+    componentClass="CameraComponent"
+    friendlyName="Camera"
+    componentType="Game"
+    description="Allows the component owner to operate as a camera."
+    scriptFile="core/components/components/game/camera.cs" />

+ 185 - 0
Templates/BaseGame/game/core/components/components/game/camera.cs

@@ -0,0 +1,185 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function CameraComponent::onAdd(%this) 
+{
+   %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
+
+   %test = %this.clientOwner;
+
+   %barf = ClientGroup.getCount();
+
+   %clientID = %this.getClientID();
+   if(%clientID && !isObject(%clientID.camera))
+   {
+      %this.scopeToClient(%clientID);
+      %this.setDirty();
+
+      %clientID.setCameraObject(%this.owner);
+      %clientID.setControlCameraFov(%this.FOV);
+      
+      %clientID.camera = %this.owner;
+   }
+
+   %res = $pref::Video::mode;
+   %derp = 0;
+}
+
+function CameraComponent::onRemove(%this)
+{
+   %clientID = %this.getClientID();
+   if(%clientID)
+      %clientID.clearCameraObject();
+}
+
+function CameraComponent::onInspectorUpdate(%this)
+{
+   //if(%this.clientOwner)
+      //%this.clientOwner.setCameraObject(%this.owner);
+}
+
+function CameraComponent::getClientID(%this)
+{
+	return ClientGroup.getObject(%this.clientOwner-1);
+}
+
+function CameraComponent::isClientCamera(%this, %client)
+{
+	%clientID = ClientGroup.getObject(%this.clientOwner-1);
+	
+	if(%client.getID() == %clientID)
+		return true;
+	else
+	    return false;
+}
+
+function CameraComponent::onClientConnect(%this, %client)
+{
+   //if(%this.isClientCamera(%client) && !isObject(%client.camera))
+   //{
+      %this.scopeToClient(%client);
+      %this.setDirty();
+      
+      %client.setCameraObject(%this.owner);
+      %client.setControlCameraFov(%this.FOV);
+      
+      %client.camera = %this.owner;
+   //}
+   //else
+   //{
+   //   echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
+   //}
+}
+
+function CameraComponent::onClientDisconnect(%this, %client)
+{
+   Parent::onClientDisconnect(%this, %client);
+   
+   if(isClientCamera(%client)){
+      %this.clearScopeToClient(%client);
+      %client.clearCameraObject();
+   }
+}
+
+///
+///
+///
+
+function VRCameraComponent::onAdd(%this) 
+{
+   %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", "");
+
+   %test = %this.clientOwner;
+
+   %barf = ClientGroup.getCount();
+
+   %clientID = %this.getClientID();
+   if(%clientID && !isObject(%clientID.camera))
+   {
+      %this.scopeToClient(%clientID);
+      %this.setDirty();
+
+      %clientID.setCameraObject(%this.owner);
+      %clientID.setControlCameraFov(%this.FOV);
+      
+      %clientID.camera = %this.owner;
+   }
+
+   %res = $pref::Video::mode;
+   %derp = 0;
+}
+
+function VRCameraComponent::onRemove(%this)
+{
+   %clientID = %this.getClientID();
+   if(%clientID)
+      %clientID.clearCameraObject();
+}
+
+function CameraComponent::onInspectorUpdate(%this)
+{
+   //if(%this.clientOwner)
+      //%this.clientOwner.setCameraObject(%this.owner);
+}
+
+function VRCameraComponent::getClientID(%this)
+{
+	return ClientGroup.getObject(%this.clientOwner-1);
+}
+
+function VRCameraComponent::isClientCamera(%this, %client)
+{
+	%clientID = ClientGroup.getObject(%this.clientOwner-1);
+	
+	if(%client.getID() == %clientID)
+		return true;
+	else
+	    return false;
+}
+
+function VRCameraComponent::onClientConnect(%this, %client)
+{
+   //if(%this.isClientCamera(%client) && !isObject(%client.camera))
+   //{
+      %this.scopeToClient(%client);
+      %this.setDirty();
+      
+      %client.setCameraObject(%this.owner);
+      %client.setControlCameraFov(%this.FOV);
+      
+      %client.camera = %this.owner;
+   //}
+   //else
+   //{
+   //   echo("CONNECTED CLIENT IS NOT CAMERA OWNER!");
+   //}
+}
+
+function VRCameraComponent::onClientDisconnect(%this, %client)
+{
+   Parent::onClientDisconnect(%this, %client);
+   
+   if(isClientCamera(%client)){
+      %this.clearScopeToClient(%client);
+      %client.clearCameraObject();
+   }
+}

+ 10 - 0
Templates/BaseGame/game/core/components/components/game/controlObject.asset.taml

@@ -0,0 +1,10 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="ControlObjectComponentAsset"
+    componentName="ControlObjectComponent"
+    componentClass="Component"
+    friendlyName="Control Object"
+    componentType="Game"
+    description="Allows the component owner to be controlled by a client."
+    scriptFile="core/components/components/game/controlObject.cs" />

+ 89 - 0
Templates/BaseGame/game/core/components/components/game/controlObject.cs

@@ -0,0 +1,89 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera.");
+
+function ControlObjectComponent::onAdd(%this)
+{
+   %this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", "");
+
+   %clientID = %this.getClientID();
+
+   if(%clientID && !isObject(%clientID.getControlObject()))
+      %clientID.setControlObject(%this.owner);
+}
+
+function ControlObjectComponent::onRemove(%this)
+{
+   %clientID = %this.getClientID();
+	
+   if(%clientID)
+      %clientID.setControlObject(0);
+}
+
+function ControlObjectComponent::onClientConnect(%this, %client)
+{
+   if(%this.isControlClient(%client) && !isObject(%client.getControlObject()))
+      %client.setControlObject(%this.owner);
+}
+
+function ControlObjectComponent::onClientDisconnect(%this, %client)
+{
+   if(%this.isControlClient(%client))
+      %client.setControlObject(0);
+}
+
+function ControlObjectComponent::getClientID(%this)
+{
+	return ClientGroup.getObject(%this.clientOwner-1);
+}
+
+function ControlObjectComponent::isControlClient(%this, %client)
+{
+	%clientID = ClientGroup.getObject(%this.clientOwner-1);
+	
+	if(%client.getID() == %clientID)
+		return true;
+	else
+	    return false;
+}
+
+function ControlObjectComponent::onInspectorUpdate(%this, %field)
+{
+   %clientID = %this.getClientID();
+	
+   if(%clientID && !isObject(%clientID.getControlObject()))
+      %clientID.setControlObject(%this.owner);
+}
+
+function switchControlObject(%client, %newControlEntity)
+{
+	if(!isObject(%client) || !isObject(%newControlEntity))
+		return error("SwitchControlObject: No client or target controller!");
+		
+	%control = %newControlEntity.getComponent(ControlObjectComponent);
+		
+	if(!isObject(%control))
+		return error("SwitchControlObject: Target controller has no conrol object behavior!");
+		
+    %client.setControlObject(%newControlEntity);
+}

+ 10 - 0
Templates/BaseGame/game/core/components/components/game/itemRotate.asset.taml

@@ -0,0 +1,10 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="ItemRotationComponentAsset"
+    componentName="ItemRotationComponent"
+    componentClass="Component"
+    friendlyName="Item Rotation"
+    componentType="Game"
+    description="Rotates the entity around an axis, like an item pickup."
+    scriptFile="core/components/components/game/itemRotate.cs" />

+ 49 - 0
Templates/BaseGame/game/core/components/components/game/itemRotate.cs

@@ -0,0 +1,49 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//registerComponent("ItemRotationComponent", "Component", "Item Rotation", "Game", false, "Rotates the entity around the z axis, like an item pickup.");
+
+function ItemRotationComponent::onAdd(%this)
+{
+   %this.addComponentField(rotationsPerMinute, "Number of rotations per minute", "float", "5", "");
+   %this.addComponentField(forward, "Rotate forward or backwards", "bool", "1", "");
+   %this.addComponentField(horizontal, "Rotate horizontal or verticle, true for horizontal", "bool", "1", "");
+}
+
+function ItemRotationComponent::Update(%this)
+{
+    %tickRate = 0.032;
+    
+	//Rotations per second is calculated based on a standard update tick being 32ms. So we scale by the tick speed, then add that to our rotation to 
+	//get a nice rotation speed.
+	if(%this.horizontal)
+	{
+		if(%this.forward)
+			%this.owner.rotation.z += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
+		else
+			%this.owner.rotation.z -= ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
+	}
+	else
+	{
+		%this.owner.rotation.x += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate;
+	}
+}

+ 10 - 0
Templates/BaseGame/game/core/components/components/game/playerSpawner.asset.taml

@@ -0,0 +1,10 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="PlayerSpawnerComponentAsset"
+    componentName="PlayerSpawner"
+    componentClass="Component"
+    friendlyName="Player Spawner"
+    componentType="Game"
+    description="When a client connects, it spawns a player object for them and attaches them to it."
+    scriptFile="core/components/components/game/playerSpawner.cs" />

+ 78 - 0
Templates/BaseGame/game/core/components/components/game/playerSpawner.cs

@@ -0,0 +1,78 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//registerComponent("PlayerSpawner", "Component", 
+//			"Player Spawner", "Game", false, "When a client connects, it spawns a player object for them and attaches them to it");
+
+function PlayerSpawner::onAdd(%this)
+{
+	%this.clientCount = 1;
+	%this.friendlyName = "Player Spawner";
+	%this.componentType = "Spawner";
+	
+	%this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject");
+}
+
+function PlayerSpawner::onClientConnect(%this, %client)
+{
+	%playerObj = spawnGameObject(%this.GameObjectName, false);
+	
+	if(!isObject(%playerObj))
+		return;
+
+	%playerObj.position = %this.owner.position;
+	
+	%playerObj.notify("onClientConnect", %client);
+	
+	switchControlObject(%client, %playerObj);
+	switchCamera(%client, %playerObj);
+	
+	%client.player = %playerObj;
+	%client.camera = %playerObj;
+	
+	%inventory = %playerObj.getComponent(InventoryController);
+	
+	if(isObject(%inventory))
+	{
+      for(%i=0; %i<5; %i++)
+      {
+         %arrow = spawnGameObject(ArrowProjectile, false);
+         
+         %inventory.addItem(%arrow);
+      }
+	}
+	
+	%playerObj.position = %this.owner.position;
+	%playerObj.rotation = "0 0 0";
+	
+	%this.clientCount++;
+}
+
+function PlayerSpawner::onClientDisConnect(%this, %client)
+{
+	
+}
+
+function PlayerSpawner::getClientID(%this)
+{
+	return ClientGroup.getObject(%this.clientOwner-1);
+}

+ 9 - 0
Templates/BaseGame/game/core/components/components/input/fpsControls.asset.taml

@@ -0,0 +1,9 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="FPSControlsComponentAsset"
+    componentName="FPSControls"
+    componentClass="Component"
+    friendlyName="FPS Controls"
+    componentType="Input"
+    description="First Person Shooter-type controls." />

+ 247 - 0
Templates/BaseGame/game/core/components/components/input/fpsControls.cs

@@ -0,0 +1,247 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//registerComponent("FPSControls", "Component", "FPS Controls", "Input", false, "First Person Shooter-type controls");
+
+function FPSControls::onAdd(%this)
+{
+   //
+	%this.beginGroup("Keys");
+		%this.addComponentField(forwardKey, "Key to bind to vertical thrust", keybind, "keyboard w");
+		%this.addComponentField(backKey, "Key to bind to vertical thrust", keybind, "keyboard s");
+		%this.addComponentField(leftKey, "Key to bind to horizontal thrust", keybind, "keyboard a");
+		%this.addComponentField(rightKey, "Key to bind to horizontal thrust", keybind, "keyboard d");
+		
+		%this.addComponentField(jump, "Key to bind to horizontal thrust", keybind, "keyboard space");
+	%this.endGroup();
+	
+	%this.beginGroup("Mouse");
+		%this.addComponentField(pitchAxis, "Key to bind to horizontal thrust", keybind, "mouse yaxis");
+		%this.addComponentField(yawAxis, "Key to bind to horizontal thrust", keybind, "mouse xaxis");
+	%this.endGroup();
+	
+	%this.addComponentField(moveSpeed, "Horizontal thrust force", float, 300.0);
+	%this.addComponentField(jumpStrength, "Vertical thrust force", float, 3.0);
+   //
+
+   %control = %this.owner.getComponent( ControlObjectComponent );
+   if(!%control)
+   	   return echo("SPECTATOR CONTROLS: No Control Object behavior!");
+		
+	//%this.Physics = %this.owner.getComponent( PlayerPhysicsComponent );
+	
+	//%this.Animation = %this.owner.getComponent( AnimationComponent );
+	
+	//%this.Camera = %this.owner.getComponent( MountedCameraComponent );
+	
+	//%this.Animation.playThread(0, "look");
+	
+	%this.setupControls(%control.getClientID());
+}
+
+function FPSControls::onRemove(%this)
+{
+   Parent::onBehaviorRemove(%this);
+   
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.forwardKey);
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.backKey);
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.leftKey);
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.rightKey);
+   
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.pitchAxis);
+   commandToClient(%control.clientOwnerID, 'removeInput', %this.yawAxis);
+}
+
+function FPSControls::onBehaviorFieldUpdate(%this, %field)
+{
+   %controller = %this.owner.getBehavior( ControlObjectBehavior );
+   commandToClient(%controller.clientOwnerID, 'updateInput', %this.getFieldValue(%field), %field);
+}
+
+function FPSControls::onClientConnect(%this, %client)
+{
+   %this.setupControls(%client);
+}
+
+
+function FPSControls::setupControls(%this, %client)
+{
+   %control = %this.owner.getComponent( ControlObjectComponent );
+   if(!%control.isControlClient(%client))
+   {
+      echo("FPS CONTROLS: Client Did Not Match");
+      return;
+   }
+   
+   %inputCommand = "FPSControls";
+
+   %test = %this.forwardKey;
+   
+   /*SetInput(%client, %this.forwardKey.x,  %this.forwardKey.y,  %inputCommand@"_forwardKey");
+   SetInput(%client, %this.backKey.x,     %this.backKey.y,     %inputCommand@"_backKey");
+   SetInput(%client, %this.leftKey.x,     %this.leftKey.y,     %inputCommand@"_leftKey");
+   SetInput(%client, %this.rightKey.x,    %this.rightKey.y,    %inputCommand@"_rightKey");
+   
+   SetInput(%client, %this.jump.x,        %this.jump.y,        %inputCommand@"_jump");
+      
+   SetInput(%client, %this.pitchAxis.x,   %this.pitchAxis.y,   %inputCommand@"_pitchAxis");
+   SetInput(%client, %this.yawAxis.x,     %this.yawAxis.y,     %inputCommand@"_yawAxis");*/
+
+   SetInput(%client, "keyboard",  "w",  %inputCommand@"_forwardKey");
+   SetInput(%client, "keyboard",  "s",     %inputCommand@"_backKey");
+   SetInput(%client, "keyboard",  "a",     %inputCommand@"_leftKey");
+   SetInput(%client, "keyboard",  "d",    %inputCommand@"_rightKey");
+   
+   SetInput(%client, "keyboard",  "space",        %inputCommand@"_jump");
+      
+   SetInput(%client, "mouse",   "yaxis",   %inputCommand@"_pitchAxis");
+   SetInput(%client, "mouse",   "xaxis",     %inputCommand@"_yawAxis");
+
+   SetInput(%client, "keyboard",   "f",     %inputCommand@"_flashlight");
+ 
+}
+
+function FPSControls::onMoveTrigger(%this, %triggerID)
+{
+   //check if our jump trigger was pressed!
+   if(%triggerID == 2)
+   {
+      %this.owner.applyImpulse("0 0 0", "0 0 " @ %this.jumpStrength);
+   }
+}
+
+function FPSControls::Update(%this)
+{
+	return;
+	
+	%moveVector = %this.owner.getMoveVector();
+	%moveRotation = %this.owner.getMoveRotation();
+	
+	%this.Physics.moveVector = "0 0 0";
+
+   if(%moveVector.x != 0)
+   {
+		%fv = VectorNormalize(%this.owner.getRightVector());
+      
+		%forMove = VectorScale(%fv, (%moveVector.x));// * (%this.moveSpeed * 0.032)));
+		
+   		//%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
+		
+		%this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
+	
+		//if(%forMove > 0)
+		//	%this.Animation.playThread(1, "run");
+   }
+	/*else
+	{
+		%fv = VectorNormalize(%this.owner.getRightVector());
+      
+		%forMove = VectorScale(%fv, (%moveVector.x * (%this.moveSpeed * 0.032)));
+	
+	    if(%forMove <= 0)
+			%this.Animation.stopThread(1);
+		
+	}*/
+   
+   if(%moveVector.y != 0)
+   {
+      %fv = VectorNormalize(%this.owner.getForwardVector());
+      
+      %forMove = VectorScale(%fv, (%moveVector.y));// * (%this.moveSpeed * 0.032)));
+	
+	  //%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
+	
+	  %this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove);
+      
+	//if(VectorLen(%this.Physics.velocity) < 2)
+    //  		%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
+   }
+   
+   /*if(%moveVector.z)
+   {
+      %fv = VectorNormalize(%this.owner.getUpVector());
+      
+      %forMove = VectorScale(%fv, (%moveVector.z * (%this.moveSpeed * 0.032)));
+      
+      %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove);
+   }*/
+   
+   if(%moveRotation.x != 0)
+   {
+		%look = mRadToDeg(%moveRotation.x) / 180;
+		
+		//%this.Animation.setThreadPos(0, %look);
+		
+		%this.owner.getComponent( MountedCameraComponent ).rotationOffset.x += mRadToDeg(%moveRotation.x);
+		
+		//%this.Camera.rotationOffset.x += mRadToDeg(%moveRotation.x);
+   }
+   //   %this.owner.rotation.x += mRadToDeg(%moveRotation.x);
+   
+   if(%moveRotation.z != 0)
+   {
+	  %zrot = mRadToDeg(%moveRotation.z);
+	  %this.owner.getComponent( MountedCameraComponent ).rotationOffset.z += %zrot;
+      //%this.owner.rotation.z += %zrot;
+   }
+}
+
+//
+function FPSControls_forwardKey(%val)
+{
+   $mvForwardAction = %val;
+}
+
+function FPSControls_backKey(%val)
+{
+   $mvBackwardAction = %val;
+}
+
+function FPSControls_leftKey(%val)
+{
+   $mvLeftAction = %val;
+}
+
+function FPSControls_rightKey(%val)
+{
+   $mvRightAction = %val;
+}
+
+function FPSControls_yawAxis(%val)
+{
+   $mvYaw += getMouseAdjustAmount(%val);
+}
+
+function FPSControls_pitchAxis(%val)
+{
+   $mvPitch += getMouseAdjustAmount(%val);
+}
+
+function FPSControls_jump(%val)
+{
+   $mvTriggerCount2++;
+}
+
+function FPSControls_flashLight(%val)
+{
+   $mvTriggerCount3++;
+}

+ 82 - 0
Templates/BaseGame/game/core/components/components/input/inputManager.cs

@@ -0,0 +1,82 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function SetInput(%client, %device, %key, %command, %bindMap, %behav)
+{
+   commandToClient(%client, 'SetInput', %device, %key, %command, %bindMap, %behav);  
+}
+
+function RemoveInput(%client, %device, %key, %command, %bindMap)
+{
+   commandToClient(%client, 'removeInput', %device, %key, %command, %bindMap);  
+}
+
+function clientCmdSetInput(%device, %key, %command, %bindMap, %behav)
+{
+   //if we're requesting a custom bind map, set that up
+   if(%bindMap $= "")
+      %bindMap = moveMap;
+   
+   if (!isObject(%bindMap)){
+      new ActionMap(moveMap);
+      moveMap.push();
+   }
+      
+   //get our local
+   //%localID = ServerConnection.resolveGhostID(%behav); 
+   
+   //%tmpl = %localID.getTemplate();
+   //%tmpl.insantiateNamespace(%tmpl.getName());
+      
+   //first, check if we have an existing command
+   %oldBind = %bindMap.getBinding(%command);
+   if(%oldBind !$= "")
+      %bindMap.unbind(getField(%oldBind, 0), getField(%oldBind, 1));
+    
+   //now, set the requested bind   
+   %bindMap.bind(%device, %key, %command);
+}
+
+function clientCmdRemoveSpecCtrlInput(%device, %key, %bindMap)
+{
+   //if we're requesting a custom bind map, set that up
+   if(%bindMap $= "")
+      %bindMap = moveMap;
+   
+   if (!isObject(%bindMap))
+      return;
+      
+   %bindMap.unbind(%device, %key);
+}
+
+function clientCmdSetupClientBehavior(%bhvrGstID)
+{
+   %localID = ServerConnection.resolveGhostID(%bhvrGstID); 
+   %tmpl = %localID.getTemplate();
+   %tmpl.insantiateNamespace(%tmpl.getName());
+}
+
+function getMouseAdjustAmount(%val)
+{
+   // based on a default camera FOV of 90'
+   return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity;
+}

+ 8 - 0
Templates/BaseGame/game/core/components/components/meshComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="MeshComponentAsset"
+    componentClass="MeshComponent"
+    friendlyName="mesh"
+    componentType="Render"
+    description="Enables an entity to render a shape." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/playerControllerComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="PlayerControllerComponentAsset"
+    componentClass="PlayerControllerComponent"
+    friendlyName="Player Controller"
+    componentType="Game"
+    description="Enables an entity to move like a player object." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/soundComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="SoundComponentAsset"
+    componentClass="SoundComponent"
+    friendlyName="Sound(Component)"
+    componentType="sound"
+    description="Stores up to 4 sounds for playback." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/stateMachineComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="StateMachineComponentAsset"
+    componentClass="StateMachineComponent"
+    friendlyName="State Machine"
+    componentType="Game"
+    description="Enables a state machine on the entity." />

+ 8 - 0
Templates/BaseGame/game/core/components/components/triggerComponent.asset.taml

@@ -0,0 +1,8 @@
+<ComponentAsset
+    canSave="true"
+    canSaveDynamicFields="true"
+    AssetName="TriggerComponentAsset"
+    componentClass="TriggerComponent"
+    friendlyName="Trigger Component"
+    componentType="Collision"
+    description="Enables callback and event behaviors on collision with the entity." />

+ 12 - 0
Templates/BaseGame/game/core/console/Core_Console.cs

@@ -0,0 +1,12 @@
+
+function Core_Console::onCreate(%this)
+{
+    exec("./scripts/profiles.cs");
+    exec("./scripts/console.cs");
+
+    exec("./guis/console.gui");
+}
+
+function Core_Console::onDestroy(%this)
+{
+}

+ 10 - 0
Templates/BaseGame/game/core/console/Core_Console.module

@@ -0,0 +1,10 @@
+<ModuleDefinition
+	ModuleId="Core_Console"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core_Console.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core"
+	Dependencies="Core_GUI=1">
+</ModuleDefinition>

+ 191 - 0
Templates/BaseGame/game/core/console/guis/console.gui

@@ -0,0 +1,191 @@
+//--- OBJECT WRITE BEGIN ---
+%guiContent = new GuiControl(ConsoleDlg) {
+   position = "0 0";
+   extent = "1024 768";
+   minExtent = "8 8";
+   horizSizing = "right";
+   vertSizing = "bottom";
+   profile = "GuiDefaultProfile";
+   visible = "1";
+   active = "1";
+   tooltipProfile = "GuiToolTipProfile";
+   hovertime = "1000";
+   isContainer = "1";
+   canSave = "1";
+   canSaveDynamicFields = "1";
+      helpTag = "0";
+
+   new GuiConsoleEditCtrl(ConsoleEntry) {
+      useSiblingScroller = "1";
+      historySize = "40";
+      tabComplete = "0";
+      sinkAllKeyEvents = "1";
+      password = "0";
+      passwordMask = "*";
+      maxLength = "255";
+      margin = "0 0 0 0";
+      padding = "0 0 0 0";
+      anchorTop = "1";
+      anchorBottom = "0";
+      anchorLeft = "1";
+      anchorRight = "0";
+      position = "0 750";
+      extent = "1024 18";
+      minExtent = "8 8";
+      horizSizing = "width";
+      vertSizing = "top";
+      profile = "ConsoleTextEditProfile";
+      visible = "1";
+      active = "1";
+      altCommand = "ConsoleEntry::eval();";
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+   };
+   new GuiContainer() {
+      margin = "0 0 0 0";
+      padding = "0 0 0 0";
+      anchorTop = "1";
+      anchorBottom = "0";
+      anchorLeft = "1";
+      anchorRight = "0";
+      position = "1 728";
+      extent = "1024 22";
+      minExtent = "8 2";
+      horizSizing = "width";
+      vertSizing = "top";
+      profile = "GuiDefaultProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+
+      new GuiBitmapCtrl() {
+         bitmap = "data/ui/art/hudfill.png";
+         color = "255 255 255 255";
+         wrap = "0";
+         position = "0 0";
+         extent = "1024 22";
+         minExtent = "8 2";
+         horizSizing = "width";
+         vertSizing = "bottom";
+         profile = "GuiDefaultProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) {
+         text = "Errors";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         position = "2 2";
+         extent = "113 20";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiCheckBoxProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) {
+         text = "Warnings";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         position = "119 2";
+         extent = "113 20";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiCheckBoxProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) {
+         text = "Normal Messages";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         position = "236 2";
+         extent = "113 20";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiCheckBoxProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+   };
+   new GuiScrollCtrl() {
+      willFirstRespond = "1";
+      hScrollBar = "alwaysOn";
+      vScrollBar = "alwaysOn";
+      lockHorizScroll = "0";
+      lockVertScroll = "0";
+      constantThumbHeight = "0";
+      childMargin = "0 0";
+      mouseWheelScrollSpeed = "-1";
+      margin = "0 0 0 0";
+      padding = "0 0 0 0";
+      anchorTop = "1";
+      anchorBottom = "0";
+      anchorLeft = "1";
+      anchorRight = "0";
+      position = "0 0";
+      extent = "1024 730";
+      minExtent = "8 8";
+      horizSizing = "width";
+      vertSizing = "height";
+      profile = "ConsoleScrollProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      internalName = "Scroll";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+
+      new GuiConsole(ConsoleMessageLogView) {
+         position = "1 1";
+         extent = "622 324";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiConsoleProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "1";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+   };
+};
+//--- OBJECT WRITE END ---

+ 137 - 0
Templates/BaseGame/game/core/console/scripts/console.cs

@@ -0,0 +1,137 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
+
+function ConsoleEntry::eval()
+{
+   %text = trim(ConsoleEntry.getValue());
+   if(%text $= "")
+      return;
+
+   // If it's missing a trailing () and it's not a variable,
+   // append the parentheses.
+   if(strpos(%text, "(") == -1 && !isDefined(%text)) {
+      if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1) {
+         if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1) {
+            %text = %text @ "()";
+         }
+      }
+   }
+
+   // Append a semicolon if need be.
+   %pos = strlen(%text) - 1;
+   if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1) {
+      %text = %text @ ";";
+   }
+
+   // Turn off warnings for assigning from void
+   // and evaluate the snippet.
+   if(!isDefined("$Con::warnVoidAssignment"))
+      %oldWarnVoidAssignment = true;
+   else
+      %oldWarnVoidAssignment = $Con::warnVoidAssignment;
+   $Con::warnVoidAssignment = false;
+
+   echo("==>" @ %text);
+   if(   !startsWith(%text, "function ")
+       && !startsWith(%text, "datablock ")
+       && !startsWith(%text, "foreach(")
+       && !startsWith(%text, "foreach$(")
+       && !startsWith(%text, "if(")
+       && !startsWith(%text, "while(")
+       && !startsWith(%text, "for(")
+       && !startsWith(%text, "switch(")
+       && !startsWith(%text, "switch$("))
+      eval("%result = " @ %text);
+   else
+      eval(%text);
+   $Con::warnVoidAssignment = %oldWarnVoidAssignment;
+
+   ConsoleEntry.setValue("");
+
+   // Echo result.
+   if(%result !$= "")
+      echo(%result);
+}
+
+function ToggleConsole(%make)
+{
+   if (%make) {
+      if (ConsoleDlg.isAwake()) {
+         // Deactivate the console.
+         Canvas.popDialog(ConsoleDlg);
+      } else {
+         Canvas.pushDialog(ConsoleDlg, 99);         
+      }
+   }
+}
+
+function ConsoleDlg::hideWindow(%this)
+{
+   %this-->Scroll.setVisible(false);
+}
+
+function ConsoleDlg::showWindow(%this)
+{
+   %this-->Scroll.setVisible(true);
+}
+
+function ConsoleDlg::onWake(%this)
+{
+   ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter());
+   ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter());
+   ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter());
+   
+   ConsoleMessageLogView.refresh();
+}
+
+function ConsoleDlg::setAlpha( %this, %alpha)
+{
+   if (%alpha $= "")
+      ConsoleScrollProfile.fillColor = $ConsoleDefaultFillColor;
+   else
+      ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0;
+}
+
+function ConsoleDlgErrorFilterBtn::onClick(%this)
+{
+   ConsoleMessageLogView.toggleErrorFilter();
+}
+
+function ConsoleDlgWarnFilterBtn::onClick(%this)
+{
+  
+   ConsoleMessageLogView.toggleWarnFilter();
+}
+
+function ConsoleDlgNormalFilterBtn::onClick(%this)
+{
+   ConsoleMessageLogView.toggleNormalFilter();
+}
+
+function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount)
+{
+   ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors");
+   ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings");
+   ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages");
+}

+ 70 - 0
Templates/BaseGame/game/core/console/scripts/profiles.cs

@@ -0,0 +1,70 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+if(!isObject(GuiConsoleProfile))
+new GuiControlProfile(GuiConsoleProfile)
+{
+   fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console";
+   fontSize = ($platform $= "macos") ? 13 : 12;
+   fontColor = "255 255 255";
+   fontColorHL = "0 255 255";
+   fontColorNA = "255 0 0";
+   fontColors[6] = "100 100 100";
+   fontColors[7] = "100 100 0";
+   fontColors[8] = "0 0 100";
+   fontColors[9] = "0 100 0";
+   category = "Core";
+};
+
+if(!isObject(GuiConsoleTextProfile))
+new GuiControlProfile(GuiConsoleTextProfile)
+{   
+   fontColor = "0 0 0";
+   autoSizeWidth = true;
+   autoSizeHeight = true;   
+   textOffset = "2 2";
+   opaque = true;   
+   fillColor = "255 255 255";
+   border = true;
+   borderThickness = 1;
+   borderColor = "0 0 0";
+   category = "Core";
+};
+
+if(!isObject(ConsoleScrollProfile))
+new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile)
+{
+	opaque = true;
+	fillColor = "0 0 0 175";
+	border = 1;
+	//borderThickness = 0;
+	borderColor = "0 0 0";
+   category = "Core";
+};
+
+if(!isObject(ConsoleTextEditProfile))
+new GuiControlProfile(ConsoleTextEditProfile : GuiTextEditProfile)
+{
+   fillColor = "242 241 240 255";
+   fillColorHL = "255 255 255";   
+   category = "Core";
+};

BIN
Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial Bold 14 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial Bold 16 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Arial Bold 18 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/ArialBold 14 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/ArialItalic 14 (ansi).uft


BIN
Templates/BaseGame/game/core/fonts/Lucida Console 12 (ansi).uft


+ 11 - 0
Templates/BaseGame/game/core/gui/Core_GUI.cs

@@ -0,0 +1,11 @@
+
+function Core_GUI::onCreate(%this)
+{
+   exec("./scripts/profiles.cs");
+   exec("./scripts/canvas.cs");
+   exec("./scripts/cursor.cs");
+}
+
+function Core_GUI::onDestroy(%this)
+{
+}

+ 10 - 0
Templates/BaseGame/game/core/gui/Core_GUI.module

@@ -0,0 +1,10 @@
+<ModuleDefinition
+	ModuleId="Core_GUI"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core_GUI.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core"
+	Dependencies="Core_Rendering=1">
+</ModuleDefinition>

BIN
Templates/BaseGame/game/core/gui/images/button.png


BIN
Templates/BaseGame/game/core/gui/images/checkbox.png


BIN
Templates/BaseGame/game/core/gui/images/group-border.png


BIN
Templates/BaseGame/game/core/gui/images/inactive-overlay.png


BIN
Templates/BaseGame/game/core/gui/images/loadingbar.png


BIN
Templates/BaseGame/game/core/gui/images/scrollBar.png


BIN
Templates/BaseGame/game/core/gui/images/textEdit.png


BIN
Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png


BIN
Templates/BaseGame/game/core/gui/images/window.png


+ 162 - 0
Templates/BaseGame/game/core/gui/scripts/canvas.cs

@@ -0,0 +1,162 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function createCanvas(%windowTitle)
+{
+   if ($isDedicated)
+   {
+      GFXInit::createNullDevice();
+      return true;
+   }
+   
+   // Create the Canvas
+   $GameCanvas = new GuiCanvas(Canvas)
+   {
+      displayWindow = $platform !$= "windows";
+   };
+
+   // Set the window title
+   if (isObject(Canvas)) 
+   {
+      Canvas.setWindowTitle(%windowTitle @ " - " @ $pref::Video::displayDevice);
+      configureCanvas();
+   } 
+   else 
+   {
+      error("Canvas creation failed. Shutting down.");
+      quit();
+   }
+}
+
+// Constants for referencing video resolution preferences
+$WORD::RES_X = 0;
+$WORD::RES_Y = 1;
+$WORD::FULLSCREEN = 2;
+$WORD::BITDEPTH = 3;
+$WORD::REFRESH = 4;
+$WORD::AA = 5;
+
+function configureCanvas()
+{
+   // Setup a good default if we don't have one already.
+   if ($pref::Video::Resolution $= "")
+      $pref::Video::Resolution = "800 600";
+   if ($pref::Video::FullScreen $= "")
+      $pref::Video::FullScreen = false;
+   if ($pref::Video::BitDepth $= "")
+      $pref::Video::BitDepth = "32";
+   if ($pref::Video::RefreshRate $= "")
+      $pref::Video::RefreshRate = "60";
+   if ($pref::Video::AA $= "")
+      $pref::Video::AA = "4";
+
+   %resX = $pref::Video::Resolution.x;
+   %resY = $pref::Video::Resolution.y;
+   %fs = $pref::Video::FullScreen;
+   %bpp = $pref::Video::BitDepth;
+   %rate = $pref::Video::RefreshRate;
+   %aa = $pref::Video::AA;
+   
+   if($cliFullscreen !$= "") {
+      %fs = $cliFullscreen;
+      $cliFullscreen = "";
+   }
+   
+   echo("--------------");
+   echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %aa @ "\"");
+   
+   %deskRes    = getDesktopResolution();      
+   %deskResX   = getWord(%deskRes, $WORD::RES_X);
+   %deskResY   = getWord(%deskRes, $WORD::RES_Y);
+   %deskResBPP = getWord(%deskRes, 2);
+   
+   // We shouldn't be getting this any more but just in case...
+   if (%bpp $= "Default")
+      %bpp = %deskResBPP;
+      
+   // Make sure we are running at a valid resolution
+   if (%fs $= "0" || %fs $= "false")
+   {
+      // Windowed mode has to use the same bit depth as the desktop
+      %bpp = %deskResBPP;
+      
+      // Windowed mode also has to run at a smaller resolution than the desktop
+      if ((%resX >= %deskResX) || (%resY >= %deskResY))
+      {
+         warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution");
+      
+         %resCount = Canvas.getModeCount();
+         for (%i = (%resCount - 1); %i >= 0; %i--)
+         {
+            %testRes = Canvas.getMode(%i);
+            %testResX = getWord(%testRes, $WORD::RES_X);
+            %testResY = getWord(%testRes, $WORD::RES_Y);
+            %testBPP  = getWord(%testRes, $WORD::BITDEPTH);
+
+            if (%testBPP != %bpp)
+               continue;
+            
+            if ((%testResX < %deskResX) && (%testResY < %deskResY))
+            {
+               // This will work as our new resolution
+               %resX = %testResX;
+               %resY = %testResY;
+               
+               warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\"");
+               
+               break;
+            }
+         }
+      }
+   }
+   
+   $pref::Video::Resolution = %resX SPC %resY;
+   $pref::Video::FullScreen = %fs;
+   $pref::Video::BitDepth = %bpp;
+   $pref::Video::RefreshRate = %rate;
+   $pref::Video::AA = %aa;
+   
+   if (%fs == 1 || %fs $= "true")
+      %fsLabel = "Yes";
+   else
+      %fsLabel = "No";
+
+   echo("Accepted Mode: " NL
+      "--Resolution : " @  %resX SPC %resY NL 
+      "--Full Screen : " @ %fsLabel NL
+      "--Bits Per Pixel : " @ %bpp NL
+      "--Refresh Rate : " @ %rate NL
+      "--AA TypeXLevel : " @ %aa NL
+      "--------------");
+
+   // Actually set the new video mode
+   Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa);
+
+   commandToServer('setClientAspectRatio', %resX, %resY);
+
+   // AA piggybacks on the AA setting in $pref::Video::mode.
+   // We need to parse the setting between AA modes, and then it's level
+   // It's formatted as AATypexAALevel
+   // So, FXAAx4 or MLAAx2
+   if ( isObject( FXAA_PostEffect ) )
+      FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false;
+}

+ 102 - 0
Templates/BaseGame/game/core/gui/scripts/cursor.cs

@@ -0,0 +1,102 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------------------------
+// Cursor toggle functions.
+//---------------------------------------------------------------------------------------------
+$cursorControlled = true;
+function showCursor()
+{
+   if ($cursorControlled)
+      lockMouse(false);
+   Canvas.cursorOn();
+}
+
+function hideCursor()
+{
+   if ($cursorControlled)
+      lockMouse(true);
+   Canvas.cursorOff();
+}
+
+//---------------------------------------------------------------------------------------------
+// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas
+// class, of which the global Canvas object is an instance. In this case, the behavior we want
+// is for the cursor to automatically display, except when the only guis visible want no
+// cursor - usually the in game interface.
+//---------------------------------------------------------------------------------------------
+package CanvasCursorPackage
+{
+
+//---------------------------------------------------------------------------------------------
+// checkCursor
+// The checkCursor method iterates through all the root controls on the canvas checking each
+// ones noCursor property. If the noCursor property exists as anything other than false or an
+// empty string on every control, the cursor will be hidden.
+//---------------------------------------------------------------------------------------------
+function GuiCanvas::checkCursor(%this)
+{
+   %count = %this.getCount();
+   for(%i = 0; %i < %count; %i++)
+   {
+      %control = %this.getObject(%i);
+      if ((%control.noCursor $= "") || !%control.noCursor)
+      {
+         showCursor();
+         return;
+      }
+   }
+   // If we get here, every control requested a hidden cursor, so we oblige.
+   hideCursor();
+}
+
+//---------------------------------------------------------------------------------------------
+// The following functions override the GuiCanvas defaults that involve changing the content
+// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one.
+//---------------------------------------------------------------------------------------------
+function GuiCanvas::setContent(%this, %ctrl)
+{
+   Parent::setContent(%this, %ctrl);
+   %this.checkCursor();
+}
+
+function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center)
+{
+   Parent::pushDialog(%this, %ctrl, %layer, %center);
+   %this.checkCursor();
+}
+
+function GuiCanvas::popDialog(%this, %ctrl)
+{
+   Parent::popDialog(%this, %ctrl);
+   %this.checkCursor();
+}
+
+function GuiCanvas::popLayer(%this, %layer)
+{
+   Parent::popLayer(%this, %layer);
+   %this.checkCursor();
+}
+
+};
+
+activatePackage(CanvasCursorPackage);

BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial 36 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft


BIN
Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft


+ 226 - 0
Templates/BaseGame/game/core/gui/scripts/profiles.cs

@@ -0,0 +1,226 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+// Set font cache path if it doesn't already exist.
+if($Gui::fontCacheDirectory $= "")
+{
+   $Gui::fontCacheDirectory = expandFilename("./fonts");
+}
+
+// ----------------------------------------------------------------------------
+// GuiDefaultProfile is a special profile that all other profiles inherit
+// defaults from. It must exist.
+// ----------------------------------------------------------------------------
+
+if(!isObject(GuiDefaultProfile))
+new GuiControlProfile (GuiDefaultProfile)
+{
+   tab = false;
+   canKeyFocus = false;
+   hasBitmapArray = false;
+   mouseOverSelected = false;
+
+   // fill color
+   opaque = false;
+   fillColor = "242 241 240";
+   fillColorHL ="228 228 235";
+   fillColorSEL = "98 100 137";
+   fillColorNA = "255 255 255 ";
+
+   // border color
+   border = 0;
+   borderColor   = "100 100 100"; 
+   borderColorHL = "50 50 50 50";
+   borderColorNA = "75 75 75"; 
+
+   // font
+   fontType = "Arial";
+   fontSize = 14;
+   fontCharset = ANSI;
+
+   fontColor = "0 0 0";
+   fontColorHL = "0 0 0";
+   fontColorNA = "0 0 0";
+   fontColorSEL= "255 255 255";
+
+   // bitmap information
+   bitmap = "";
+   bitmapBase = "";
+   textOffset = "0 0";
+
+   // used by guiTextControl
+   modal = true;
+   justify = "left";
+   autoSizeWidth = false;
+   autoSizeHeight = false;
+   returnTab = false;
+   numbersOnly = false;
+   cursorColor = "0 0 0 255";
+};
+
+if(!isObject(GuiToolTipProfile))
+new GuiControlProfile (GuiToolTipProfile)
+{
+   // fill color
+   fillColor = "239 237 222";
+
+   // border color
+   borderColor   = "138 134 122";
+
+   // font
+   fontType = "Arial";
+   fontSize = 14;
+   fontColor = "0 0 0";
+
+   category = "Core";
+};
+
+if(!isObject(GuiWindowProfile))
+new GuiControlProfile (GuiWindowProfile)
+{
+   opaque = false;
+   border = 2;
+   fillColor = "242 241 240";
+   fillColorHL = "221 221 221";
+   fillColorNA = "200 200 200";
+   fontColor = "50 50 50";
+   fontColorHL = "0 0 0";
+   bevelColorHL = "255 255 255";
+   bevelColorLL = "0 0 0";
+   text = "untitled";
+   bitmap = "core/gui/images/window";
+   textOffset = "8 4";
+   hasBitmapArray = true;
+   justify = "left";
+   category = "Core";
+};
+
+
+if(!isObject(GuiTextEditProfile))
+new GuiControlProfile(GuiTextEditProfile)
+{
+   opaque = true;
+   bitmap = "core/gui/images/textEdit";
+   hasBitmapArray = true; 
+   border = -2;
+   fillColor = "242 241 240 0";
+   fillColorHL = "255 255 255";
+   fontColor = "0 0 0";
+   fontColorHL = "255 255 255";
+   fontColorSEL = "98 100 137";
+   fontColorNA = "200 200 200";
+   textOffset = "4 2";
+   autoSizeWidth = false;
+   autoSizeHeight = true;
+   justify = "left";
+   tab = true;
+   canKeyFocus = true;   
+   category = "Core";
+};
+
+if(!isObject(GuiScrollProfile))
+new GuiControlProfile(GuiScrollProfile)
+{
+   opaque = true;
+   fillcolor = "255 255 255";
+   fontColor = "0 0 0";
+   fontColorHL = "150 150 150";
+   border = true;
+   bitmap = "core/gui/images/scrollBar";
+   hasBitmapArray = true;
+   category = "Core";
+};
+
+if(!isObject(GuiOverlayProfile))
+new GuiControlProfile(GuiOverlayProfile)
+{
+   opaque = true;
+   fontColor = "0 0 0";
+   fontColorHL = "255 255 255";
+	fillColor = "0 0 0 100";
+   category = "Core";
+};
+
+if(!isObject(GuiCheckBoxProfile))
+new GuiControlProfile(GuiCheckBoxProfile)
+{
+   opaque = false;
+   fillColor = "232 232 232";
+   border = false;
+   borderColor = "100 100 100";
+   fontSize = 14;
+   fontColor = "20 20 20";
+   fontColorHL = "80 80 80";
+	fontColorNA = "200 200 200";
+   fixedExtent = true;
+   justify = "left";
+   bitmap = "core/gui/images/checkbox";
+   hasBitmapArray = true;
+   category = "Tools";
+};
+
+if( !isObject( GuiProgressProfile ) )
+new GuiControlProfile( GuiProgressProfile )
+{
+   opaque = false;
+   fillColor = "0 162 255 200";
+   border = true;
+   borderColor   = "50 50 50 200";
+   category = "Core";
+};
+
+if( !isObject( GuiProgressBitmapProfile ) )
+new GuiControlProfile( GuiProgressBitmapProfile )
+{
+   border = false;
+   hasBitmapArray = true;
+   bitmap = "core/gui/images/loadingbar";
+   category = "Core";
+};
+
+if( !isObject( GuiProgressTextProfile ) )
+new GuiControlProfile( GuiProgressTextProfile )
+{
+   fontSize = "14";
+	fontType = "Arial";
+   fontColor = "0 0 0";
+   justify = "center";
+   category = "Core";   
+};
+
+if( !isObject( GuiButtonProfile ) )
+new GuiControlProfile( GuiButtonProfile )
+{
+   opaque = true;
+   border = true;
+	 
+   fontColor = "50 50 50";
+   fontColorHL = "0 0 0";
+	 fontColorNA = "200 200 200";
+	 //fontColorSEL ="0 0 0";
+   fixedExtent = false;
+   justify = "center";
+   canKeyFocus = false;
+	bitmap = "core/gui/images/button";
+   hasBitmapArray = false;
+   category = "Core";
+};

+ 20 - 0
Templates/BaseGame/game/core/lighting/Core_Lighting.cs

@@ -0,0 +1,20 @@
+
+function Core_Lighting::onCreate(%this)
+{
+   exec("./scripts/lighting.cs");
+   
+   //Advanced/Deferred
+   exec("./scripts/advancedLighting_Shaders.cs");
+   exec("./scripts/deferredShading.cs");
+   exec("./scripts/advancedLighting_Init.cs");
+   
+   //Basic/Forward
+   exec("./scripts/basicLighting_shadowFilter.cs");
+   exec("./scripts/shadowMaps_Init.cs");
+   exec("./scripts/basicLighting_Init.cs");
+   
+}
+
+function Core_Lighting::onDestroy(%this)
+{
+}

+ 9 - 0
Templates/BaseGame/game/core/lighting/Core_Lighting.module

@@ -0,0 +1,9 @@
+<ModuleDefinition
+	ModuleId="Core_Lighting"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core_Lighting.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core">
+</ModuleDefinition>

+ 68 - 0
Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs

@@ -0,0 +1,68 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+///////////////////////////////////////////////////////////////////////////////
+// Default Prefs
+
+/*
+$pref::LightManager::sgAtlasMaxDynamicLights = "16";
+$pref::LightManager::sgDynamicShadowDetailSize = "0";
+$pref::LightManager::sgDynamicShadowQuality = "0";
+$pref::LightManager::sgLightingProfileAllowShadows = "1";
+$pref::LightManager::sgLightingProfileQuality = "0";
+$pref::LightManager::sgMaxBestLights = "10";
+$pref::LightManager::sgMultipleDynamicShadows = "1";
+$pref::LightManager::sgShowCacheStats = "0";
+$pref::LightManager::sgUseBloom = "";
+$pref::LightManager::sgUseDRLHighDynamicRange = "0";
+$pref::LightManager::sgUseDynamicRangeLighting = "0";
+$pref::LightManager::sgUseDynamicShadows = "1";
+$pref::LightManager::sgUseToneMapping = "";
+*/
+
+//exec( "./shaders.cs" );
+//exec( "./deferredShading.cs" );
+
+function onActivateAdvancedLM()
+{
+   // Enable the offscreen target so that AL will work
+   // with MSAA back buffers and for HDR rendering.   
+   AL_FormatToken.enable();
+     
+   // Activate Deferred Shading
+   AL_DeferredShading.enable();
+}
+
+function onDeactivateAdvancedLM()
+{
+   // Disable the offscreen render target.
+   AL_FormatToken.disable();
+      
+   // Deactivate Deferred Shading
+   AL_DeferredShading.disable();
+}
+
+function setAdvancedLighting()
+{
+   setLightManager( "Advanced Lighting" );   
+}
+

+ 276 - 0
Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs

@@ -0,0 +1,276 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+// Vector Light State
+new GFXStateBlockData( AL_VectorLightState )
+{
+   blendDefined = true;
+   blendEnable = true;
+   blendSrc = GFXBlendOne;
+   blendDest = GFXBlendOne;
+   blendOp = GFXBlendOpAdd;
+   
+   zDefined = true;
+   zEnable = false;
+   zWriteEnable = false;
+
+   samplersDefined = true;
+   samplerStates[0] = SamplerClampPoint;  // G-buffer
+   mSamplerNames[0] = "deferredBuffer";
+   samplerStates[1] = SamplerClampPoint;  // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
+   mSamplerNames[1] = "shadowMap";
+   samplerStates[2] = SamplerClampPoint;  // Shadow Map (Do not change this to linear, as all cards can not filter equally.)
+   mSamplerNames[2] = "dynamicShadowMap";
+   samplerStates[3] = SamplerClampLinear;  // SSAO Mask
+   mSamplerNames[3] = "ssaoMask";
+   samplerStates[4] = SamplerWrapPoint;   // Random Direction Map
+   
+   cullDefined = true;
+   cullMode = GFXCullNone;
+   
+   stencilDefined = true;
+   stencilEnable = true;
+   stencilFailOp = GFXStencilOpKeep;
+   stencilZFailOp = GFXStencilOpKeep;
+   stencilPassOp = GFXStencilOpKeep;
+   stencilFunc = GFXCmpLess;
+   stencilRef = 0;
+};
+
+// Vector Light Material
+new ShaderData( AL_VectorLightShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/farFrustumQuadV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/vectorLightP.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/farFrustumQuadV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/vectorLightP.glsl";
+   
+   samplerNames[0] = "$deferredBuffer";
+   samplerNames[1] = "$shadowMap";
+   samplerNames[2] = "$dynamicShadowMap";
+   samplerNames[3] = "$ssaoMask";
+   samplerNames[4] = "$gTapRotationTex";
+   samplerNames[5] = "$lightBuffer";
+   samplerNames[6] = "$colorBuffer";
+   samplerNames[7] = "$matInfoBuffer";  
+   
+   pixVersion = 3.0;
+};
+
+new CustomMaterial( AL_VectorLightMaterial )
+{
+   shader = AL_VectorLightShader;
+   stateBlock = AL_VectorLightState;
+   
+   sampler["deferredBuffer"] = "#deferred";
+   sampler["shadowMap"] = "$dynamiclight";
+   sampler["dynamicShadowMap"] = "$dynamicShadowMap";
+   sampler["ssaoMask"] = "#ssaoMask";  
+   sampler["lightBuffer"] = "#lightinfo";
+   sampler["colorBuffer"] = "#color";
+   sampler["matInfoBuffer"] = "#matinfo";
+   
+   target = "lightinfo";
+   
+   pixVersion = 3.0;
+};
+
+//------------------------------------------------------------------------------
+
+// Convex-geometry light states
+new GFXStateBlockData( AL_ConvexLightState )
+{
+   blendDefined = true;
+   blendEnable = true;
+   blendSrc = GFXBlendOne;
+   blendDest = GFXBlendOne;
+   blendOp = GFXBlendOpAdd;
+   
+   zDefined = true;
+   zEnable = true;
+   zWriteEnable = false;
+   zFunc = GFXCmpGreaterEqual;
+
+   samplersDefined = true;
+   samplerStates[0] = SamplerClampPoint;  // G-buffer
+   mSamplerNames[0] = "deferredBuffer";
+   samplerStates[1] = SamplerClampPoint;  // Shadow Map (Do not use linear, these are perspective projections)
+   mSamplerNames[1] = "shadowMap";
+   samplerStates[2] = SamplerClampPoint;  // Shadow Map (Do not use linear, these are perspective projections)
+   mSamplerNames[2] = "dynamicShadowMap";
+   samplerStates[3] = SamplerClampLinear; // Cookie Map   
+   samplerStates[4] = SamplerWrapPoint;   // Random Direction Map
+   
+   cullDefined = true;
+   cullMode = GFXCullCW;
+   
+   stencilDefined = true;
+   stencilEnable = true;
+   stencilFailOp = GFXStencilOpKeep;
+   stencilZFailOp = GFXStencilOpKeep;
+   stencilPassOp = GFXStencilOpKeep;
+   stencilFunc = GFXCmpLess;
+   stencilRef = 0;
+};
+
+// Point Light Material
+new ShaderData( AL_PointLightShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/pointLightP.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
+
+   samplerNames[0] = "$deferredBuffer";
+   samplerNames[1] = "$shadowMap";
+   samplerNames[2] = "$dynamicShadowMap";
+   samplerNames[3] = "$cookieMap";
+   samplerNames[4] = "$gTapRotationTex";
+   samplerNames[5] = "$lightBuffer";
+   samplerNames[6] = "$colorBuffer";
+   samplerNames[7] = "$matInfoBuffer";
+   
+   pixVersion = 3.0;
+};
+
+new CustomMaterial( AL_PointLightMaterial )
+{
+   shader = AL_PointLightShader;
+   stateBlock = AL_ConvexLightState;
+   
+   sampler["deferredBuffer"] = "#deferred";
+   sampler["shadowMap"] = "$dynamiclight";
+   sampler["dynamicShadowMap"] = "$dynamicShadowMap";
+   sampler["cookieMap"] = "$dynamiclightmask";
+   sampler["lightBuffer"] = "#lightinfo";
+   sampler["colorBuffer"] = "#color";
+   sampler["matInfoBuffer"] = "#matinfo";
+   
+   target = "lightinfo";
+   
+   pixVersion = 3.0;
+};
+
+// Spot Light Material
+new ShaderData( AL_SpotLightShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/spotLightP.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/spotLightP.glsl";
+   
+   samplerNames[0] = "$deferredBuffer";
+   samplerNames[1] = "$shadowMap";
+   samplerNames[2] = "$dynamicShadowMap";
+   samplerNames[3] = "$cookieMap";
+   samplerNames[4] = "$gTapRotationTex";
+   samplerNames[5] = "$lightBuffer";
+   samplerNames[6] = "$colorBuffer";
+   samplerNames[7] = "$matInfoBuffer";
+
+   pixVersion = 3.0;
+};
+
+new CustomMaterial( AL_SpotLightMaterial )
+{
+   shader = AL_SpotLightShader;
+   stateBlock = AL_ConvexLightState;
+   
+   sampler["deferredBuffer"] = "#deferred";
+   sampler["shadowMap"] = "$dynamiclight";
+   sampler["dynamicShadowMap"] = "$dynamicShadowMap";
+   sampler["cookieMap"] = "$dynamiclightmask";
+   sampler["lightBuffer"] = "#lightinfo";
+   sampler["colorBuffer"] = "#color";
+   sampler["matInfoBuffer"] = "#matinfo";
+   
+   target = "lightinfo";
+   
+   pixVersion = 3.0;
+};
+
+/// This material is used for generating deferred 
+/// materials for objects that do not have materials.
+new Material( AL_DefaultDeferredMaterial )
+{
+   // We need something in the first pass else it 
+   // won't create a proper material instance.  
+   //
+   // We use color here because some objects may not
+   // have texture coords in their vertex format... 
+   // for example like terrain.
+   //
+   diffuseColor[0] = "1 1 1 1";
+};
+
+/// This material is used for generating shadow 
+/// materials for objects that do not have materials.
+new Material( AL_DefaultShadowMaterial )
+{
+   // We need something in the first pass else it 
+   // won't create a proper material instance.  
+   //
+   // We use color here because some objects may not
+   // have texture coords in their vertex format... 
+   // for example like terrain.
+   //
+   diffuseColor[0] = "1 1 1 1";
+               
+   // This is here mostly for terrain which uses
+   // this material to create its shadow material.
+   //
+   // At sunset/sunrise the sun is looking thru 
+   // backsides of the terrain which often are not
+   // closed.  By changing the material to be double
+   // sided we avoid holes in the shadowed geometry.
+   //
+   doubleSided = true;
+};
+
+// Particle System Point Light Material
+new ShaderData( AL_ParticlePointLightShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightP.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl";
+   
+   samplerNames[0] = "$deferredBuffer";   
+      
+   pixVersion = 3.0;
+};
+
+new CustomMaterial( AL_ParticlePointLightMaterial )
+{
+   shader = AL_ParticlePointLightShader;
+   stateBlock = AL_ConvexLightState;
+   
+   sampler["deferredBuffer"] = "#deferred";
+   target = "lightinfo";
+   
+   pixVersion = 3.0;
+};

+ 92 - 0
Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs

@@ -0,0 +1,92 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+//exec( "./shadowFilter.cs" );
+
+singleton GFXStateBlockData( BL_ProjectedShadowSBData )
+{
+   blendDefined = true;
+   blendEnable = true;
+   blendSrc = GFXBlendDestColor;
+   blendDest = GFXBlendZero;
+         
+   zDefined = true;
+   zEnable = true;
+   zWriteEnable = false;
+               
+   samplersDefined = true;
+   samplerStates[0] = SamplerClampLinear;   
+   vertexColorEnable = true;
+};
+
+singleton ShaderData( BL_ProjectedShadowShaderData )
+{
+   DXVertexShaderFile     = $Core::CommonShaderPath @ "/projectedShadowV.hlsl";
+   DXPixelShaderFile      = $Core::CommonShaderPath @ "/projectedShadowP.hlsl";   
+   
+   OGLVertexShaderFile     = $Core::CommonShaderPath @ "/gl/projectedShadowV.glsl";
+   OGLPixelShaderFile      = $Core::CommonShaderPath @ "/gl/projectedShadowP.glsl";   
+      
+   samplerNames[0] = "inputTex";
+   
+   pixVersion = 2.0;
+};
+
+singleton CustomMaterial( BL_ProjectedShadowMaterial )
+{
+   sampler["inputTex"] = "$miscbuff";
+ 
+   shader = BL_ProjectedShadowShaderData;
+   stateBlock = BL_ProjectedShadowSBData;
+   version = 2.0;
+   forwardLit = true;
+};
+
+function onActivateBasicLM()
+{
+   // If HDR is enabled... enable the special format token.
+   if ( $platform !$= "macos" && HDRPostFx.isEnabled )
+      AL_FormatToken.enable();
+      
+   // Create render pass for projected shadow.
+   new RenderPassManager( BL_ProjectedShadowRPM );
+
+   // Create the mesh bin and add it to the manager.
+   %meshBin = new RenderMeshMgr();
+   BL_ProjectedShadowRPM.addManager( %meshBin );
+   
+   // Add both to the root group so that it doesn't
+   // end up in the MissionCleanup instant group.
+   RootGroup.add( BL_ProjectedShadowRPM );
+   RootGroup.add( %meshBin );      
+}
+
+function onDeactivateBasicLM()
+{
+   // Delete the pass manager which also deletes the bin.
+   BL_ProjectedShadowRPM.delete();
+}
+
+function setBasicLighting()
+{
+   setLightManager( "Basic Lighting" );   
+}

+ 76 - 0
Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs

@@ -0,0 +1,76 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+singleton ShaderData( BL_ShadowFilterShaderV )
+{   
+   DXVertexShaderFile 	= $Core::CommonShaderPath @ "/lighting/basic/shadowFilterV.hlsl";
+   DXPixelShaderFile 	= $Core::CommonShaderPath @ "/lighting/basic/shadowFilterP.hlsl";
+   
+   OGLVertexShaderFile  = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterV.glsl";
+   OGLPixelShaderFile   = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterP.glsl";
+
+   samplerNames[0] = "$diffuseMap";
+
+   defines = "BLUR_DIR=float2(1.0,0.0)";
+
+   pixVersion = 2.0;     
+};
+
+singleton ShaderData( BL_ShadowFilterShaderH : BL_ShadowFilterShaderV )
+{
+    defines = "BLUR_DIR=float2(0.0,1.0)";
+};
+
+
+singleton GFXStateBlockData( BL_ShadowFilterSB : PFX_DefaultStateBlock )
+{
+   colorWriteDefined=true;
+   colorWriteRed=false;
+   colorWriteGreen=false;
+   colorWriteBlue=false;
+   blendDefined = true;
+   blendEnable = true;
+};
+
+// NOTE: This is ONLY used in Basic Lighting, and 
+// only directly by the ProjectedShadow.  It is not 
+// meant to be manually enabled like other PostEffects.
+singleton PostEffect( BL_ShadowFilterPostFx )
+{
+    // Blur vertically
+   shader = BL_ShadowFilterShaderV;
+   stateBlock = PFX_DefaultStateBlock;
+   targetClear = "PFXTargetClear_OnDraw";
+   targetClearColor = "0 0 0 0";
+   texture[0] = "$inTex";
+   target = "$outTex";   
+
+   // Blur horizontal
+   new PostEffect()
+   {
+      shader = BL_ShadowFilterShaderH;
+      stateBlock = PFX_DefaultStateBlock;
+      texture[0] = "$inTex";
+      target = "$outTex";
+   };
+};

+ 71 - 0
Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs

@@ -0,0 +1,71 @@
+singleton ShaderData( ClearGBufferShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferP.hlsl";
+
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredClearGBufferP.glsl";
+
+   pixVersion = 2.0;   
+};
+
+singleton ShaderData( DeferredColorShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl";
+   
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredColorShaderP.glsl";
+
+   pixVersion = 2.0;   
+};
+
+// Primary Deferred Shader
+new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock )
+{  
+   cullMode = GFXCullNone;
+   
+   blendDefined = true;
+   blendEnable = true; 
+   blendSrc = GFXBlendSrcAlpha;
+   blendDest = GFXBlendInvSrcAlpha;
+   
+   samplersDefined = true;
+   samplerStates[0] = SamplerWrapLinear;
+   samplerStates[1] = SamplerWrapLinear;
+   samplerStates[2] = SamplerWrapLinear;
+   samplerStates[3] = SamplerWrapLinear;
+   samplerStates[4] = SamplerWrapLinear;
+};
+
+new ShaderData( AL_DeferredShader )
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/deferredShadingP.hlsl";
+   
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
+   OGLPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl";
+
+   samplerNames[0] = "colorBufferTex";
+   samplerNames[1] = "lightDeferredTex";
+   samplerNames[2] = "matInfoTex";
+   samplerNames[3] = "deferredTex";
+   
+   pixVersion = 2.0;
+};
+
+singleton PostEffect( AL_DeferredShading )
+{
+   renderTime = "PFXAfterBin";
+   renderBin = "SkyBin";
+   shader = AL_DeferredShader;
+   stateBlock = AL_DeferredShadingState;
+   texture[0] = "#color";
+   texture[1] = "#lightinfo";
+   texture[2] = "#matinfo";
+   texture[3] = "#deferred";
+   
+   target = "$backBuffer";
+   renderPriority = 10000;
+   allowReflectPass = true;
+};

+ 74 - 0
Templates/BaseGame/game/core/lighting/scripts/lighting.cs

@@ -0,0 +1,74 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+function initLightingSystems(%manager)
+{
+   echo( "\nInitializing Lighting Systems" );
+
+   // First exec the scripts for the different light managers
+   // in the lighting folder.
+   /*%pattern = "./lighting/*//*init.cs";   
+   %file = findFirstFile( %pattern );
+   if ( %file $= "" )
+   {
+      // Try for DSOs next.
+      %pattern = "./lighting/*//*init.cs.dso";
+      %file = findFirstFile( %pattern );
+   }
+
+   while( %file !$= "" )
+   {      
+      exec( %file );
+      %file = findNextFile( %pattern );
+   }*/
+
+   // Try the perfered one first.
+   %success = setLightManager(%manager);
+
+   // Did we completely fail to initialize a light manager?   
+   if (!%success)
+   {
+      // If we completely failed to initialize a light 
+      // manager then the 3d scene cannot be rendered.
+      quitWithErrorMessage( "Failed to set a light manager!" );
+   }
+}
+
+//---------------------------------------------------------------------------------------------
+
+function onLightManagerActivate( %lmName )
+{
+   // Call activation callbacks.
+   %activateNewFn = "onActivate" @ getWord( %lmName, 0 ) @ "LM";   
+   if( isFunction( %activateNewFn ) )
+      eval( %activateNewFn @ "();" );
+}
+
+//---------------------------------------------------------------------------------------------
+
+function onLightManagerDeactivate( %lmName )
+{
+   // Call deactivation callback.
+   %deactivateOldFn = "onDeactivate" @ getWord( %lmName, 0 ) @ "LM";
+   if( isFunction( %deactivateOldFn ) )
+      eval( %deactivateOldFn @ "();" );
+}

+ 32 - 0
Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs

@@ -0,0 +1,32 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+new ShaderData(BlurDepthShader)
+{
+   DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterV.hlsl";
+   DXPixelShaderFile  = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterP.hlsl";
+   
+   OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterV.glsl";
+   OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterP.glsl";
+   pixVersion = 2.0;
+};

+ 33 - 0
Templates/BaseGame/game/core/postFX/Core_PostFX.cs

@@ -0,0 +1,33 @@
+
+function Core_PostFX::onCreate(%this)
+{
+   //
+   exec("./scripts/postFx.cs");
+   /*exec("./scripts/postFxManager.gui.cs");
+   exec("./scripts/postFxManager.gui.settings.cs");
+   exec("./scripts/postFxManager.persistance.cs");
+   
+   exec("./scripts/default.postfxpreset.cs");
+   
+   exec("./scripts/caustics.cs");
+   exec("./scripts/chromaticLens.cs");
+   exec("./scripts/dof.cs");
+   exec("./scripts/edgeAA.cs");
+   exec("./scripts/flash.cs");
+   exec("./scripts/fog.cs");
+   exec("./scripts/fxaa.cs");
+   exec("./scripts/GammaPostFX.cs");
+   exec("./scripts/glow.cs");
+   exec("./scripts/hdr.cs");
+   exec("./scripts/lightRay.cs");
+   exec("./scripts/MLAA.cs");
+   exec("./scripts/MotionBlurFx.cs");
+   exec("./scripts/ovrBarrelDistortion.cs");
+   exec("./scripts/ssao.cs");
+   exec("./scripts/turbulence.cs");
+   exec("./scripts/vignette.cs");*/
+}
+
+function Core_PostFX::onDestroy(%this)
+{
+}

+ 10 - 0
Templates/BaseGame/game/core/postFX/Core_PostFX.module

@@ -0,0 +1,10 @@
+<ModuleDefinition
+	ModuleId="Core_PostFX"
+	VersionId="1"
+	Description="Module that implements the core engine-level setup for the game."
+	ScriptFile="Core_PostFX.cs"
+	CreateFunction="onCreate"
+	DestroyFunction="onDestroy"
+	Group="Core"
+	Dependencies="Core_Rendering=1,Core_Lighting=1">
+</ModuleDefinition>

+ 2755 - 0
Templates/BaseGame/game/core/postFX/guis/postFxManager.gui

@@ -0,0 +1,2755 @@
+//--- OBJECT WRITE BEGIN ---
+%guiContent = new GuiControl(PostFXManager) {
+   position = "0 0";
+   extent = "1024 768";
+   minExtent = "8 8";
+   horizSizing = "width";
+   vertSizing = "height";
+   profile = "GuiModelessDialogProfile";
+   visible = "1";
+   active = "1";
+   tooltipProfile = "GuiToolTipProfile";
+   hovertime = "1000";
+   isContainer = "1";
+   canSave = "1";
+   canSaveDynamicFields = "1";
+
+   new DbgFileView() {
+      position = "0 0";
+      extent = "8 2";
+      minExtent = "8 2";
+      horizSizing = "right";
+      vertSizing = "bottom";
+      profile = "GuiDefaultProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+   };
+   new GuiWindowCtrl(ppOptionsWindow) {
+      text = "PostFX Manager";
+      resizeWidth = "0";
+      resizeHeight = "0";
+      canMove = "1";
+      canClose = "1";
+      canMinimize = "0";
+      canMaximize = "0";
+      canCollapse = "0";
+      closeCommand = "Canvas.popDialog(PostFXManager);";
+      edgeSnap = "0";
+      margin = "0 0 0 0";
+      padding = "0 0 0 0";
+      anchorTop = "1";
+      anchorBottom = "0";
+      anchorLeft = "1";
+      anchorRight = "0";
+      position = "306 216";
+      extent = "411 336";
+      minExtent = "8 8";
+      horizSizing = "center";
+      vertSizing = "center";
+      profile = "GuiWindowProfile";
+      visible = "1";
+      active = "1";
+      tooltipProfile = "GuiToolTipProfile";
+      hovertime = "1000";
+      isContainer = "1";
+      canSave = "1";
+      canSaveDynamicFields = "0";
+
+      new GuiBitmapBorderCtrl() {
+         position = "11 77";
+         extent = "390 216";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiTabBorderProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiTabBookCtrl(ppOptionsTabBook) {
+         tabPosition = "Top";
+         tabMargin = "7";
+         minTabWidth = "32";
+         tabHeight = "20";
+         allowReorder = "0";
+         defaultPage = "-1";
+         selectedPage = "1";
+         frontTabPadding = "0";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "11 58";
+         extent = "394 233";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiTabBookProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "1";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+
+         new GuiTabPageCtrl(ppOptionsSSAOTab) {
+            fitBook = "0";
+            text = "SSAO";
+            maxLength = "1024";
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "1";
+            anchorLeft = "1";
+            anchorRight = "1";
+            position = "0 20";
+            extent = "394 213";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "0";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            tooltip = "Options for the Screen Space Ambient Occlusion postFX";
+            hovertime = "1000";
+            isContainer = "1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiBitmapBorderCtrl() {
+               position = "12 30";
+               extent = "365 170";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBorderProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "1";
+            };
+            new GuiTabBookCtrl(ppOptionsSSAOOptions) {
+               tabPosition = "Top";
+               tabMargin = "7";
+               minTabWidth = "64";
+               tabHeight = "20";
+               allowReorder = "0";
+               defaultPage = "-1";
+               selectedPage = "2";
+               frontTabPadding = "0";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "12 11";
+               extent = "362 185";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBookProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+
+               new GuiTabPageCtrl(ppOptionsSSAOGeneralTab) {
+                  fitBook = "0";
+                  text = "General";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "362 165";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "0";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains general overall settings for the SSAO postFX";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiTextCtrl(ppOptionsSSAOOverallStrengthLabel) {
+                     text = "Overall Strength";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "31 57";
+                     extent = "77 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the overall strength of the Ambient Occlusion effect.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOBlurDepthLabel) {
+                     text = "Blur (Softness)";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "38 85";
+                     extent = "73 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the amount of softness in the SSAO, overall.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOBlurNormalLabel) {
+                     text = "Blur (Normal Maps)";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "19 112";
+                     extent = "92 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the amount of softness in the SSAO, in the normal maps.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiPopUpMenuCtrl(ppOptionsSSAOQuality) {
+                     maxPopupHeight = "200";
+                     sbUsesNAColor = "0";
+                     reverseTextList = "0";
+                     bitmapBounds = "16 16";
+                     text = "Low";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "120 28";
+                     extent = "211 20";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiPopUpMenuProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOQualityLabel) {
+                     text = "Quality";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "76 29";
+                     extent = "32 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOOverallStrength) {
+                     range = "0 50";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "2";
+                     position = "120 56";
+                     extent = "211 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOBlurDepth) {
+                     range = "0 0.3";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.001";
+                     position = "120 86";
+                     extent = "211 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOBlurNormal) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.95";
+                     position = "119 113";
+                     extent = "212 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+               new GuiTabPageCtrl(ppOptionsSSAONearTab) {
+                  fitBook = "0";
+                  text = "Near";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "362 165";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "0";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings for the near range ambient occlusion aspect of the SSAO postFX";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiSliderCtrl(ppOptionsSSAONearRadius) {
+                     range = "0.001 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.1";
+                     position = "122 17";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAONearDepthMin) {
+                     range = "0 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.1";
+                     position = "122 62";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAONearStrength) {
+                     range = "0 20";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "6";
+                     position = "122 39";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearRadiusLabel) {
+                     text = "Radius";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "80 16";
+                     extent = "34 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the near/small radius SSAO reach.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearStrengthLabel) {
+                     text = "Strength";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "73 38";
+                     extent = "41 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the near/small radius SSAO strength.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearDepthMinLabel) {
+                     text = "Depth Min";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "66 61";
+                     extent = "48 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the near/small radius SSAO minimum depth value.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearDepthMaxLabel) {
+                     text = "Depth Max";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "62 85";
+                     extent = "52 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the near/small radius SSAO maximum depth value.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAONearDepthMax) {
+                     range = "0 50";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "1";
+                     position = "122 86";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAONearToleranceNormal) {
+                     range = "0 2";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "122 133";
+                     extent = "103 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAONearTolerancePower) {
+                     range = "0 2";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "1";
+                     position = "246 133";
+                     extent = "97 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearToleranceLabel2) {
+                     text = "Tolerance / Power";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "24 132";
+                     extent = "92 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAONearToleranceLabel1) {
+                     text = "Normal Maps : ";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "19 113";
+                     extent = "71 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+               new GuiTabPageCtrl(ppOptionsSSAOFarTab) {
+                  fitBook = "0";
+                  text = "Far";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "362 165";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "1";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings for the far range ambient occlusion aspect of the SSAO postFX";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiTextCtrl(ppOptionsSSAOFarRadiusLabel) {
+                     text = "Radius";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "80 16";
+                     extent = "34 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the far/large radius SSAO reach.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarRadius) {
+                     range = "0.001 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "1";
+                     position = "122 17";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOFarStrengthLabel) {
+                     text = "Strength";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "73 38";
+                     extent = "41 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the far/large radius SSAO strength.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarStrength) {
+                     range = "0 20";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "10";
+                     position = "122 39";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOFarDepthMinLabel) {
+                     text = "Depth Min";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "66 61";
+                     extent = "48 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the far/large radius SSAO minimum depth.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarDepthMin) {
+                     range = "0 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.2";
+                     position = "122 62";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOFarDepthMaxLabel) {
+                     text = "Depth Max";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "62 85";
+                     extent = "52 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Controls the far/large radius SSAO maximum.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarDepthMax) {
+                     range = "0 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "2";
+                     position = "122 86";
+                     extent = "221 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsSSAOFarToleranceLabel1) {
+                     text = "Normal Maps :";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "6 113";
+                     extent = "72 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl() {
+                     text = "Tolerance / Power";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "24 132";
+                     extent = "90 18";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarToleranceNormal) {
+                     range = "0 2";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "122 133";
+                     extent = "100 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsSSAOFarTolerancePower) {
+                     range = "0 2";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "2";
+                     position = "239 133";
+                     extent = "104 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+            };
+            new GuiCheckBoxCtrl(ppOptionsEnableSSAO) {
+               useInactiveState = "0";
+               text = "Enable";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "329 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enable/Disable the SSAO postFX";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+         new GuiTabPageCtrl(ppOptionsHDRTab) {
+            fitBook = "0";
+            text = "HDR";
+            maxLength = "1024";
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "1";
+            anchorLeft = "1";
+            anchorRight = "1";
+            position = "0 20";
+            extent = "394 213";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "1";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            tooltip = "Options for the High Definition Range Lighting postFX";
+            hovertime = "1000";
+            isContainer = "1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiBitmapBorderCtrl() {
+               position = "12 30";
+               extent = "363 172";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBorderProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "1";
+            };
+            new GuiTabBookCtrl(ppOptionsHDROptions) {
+               tabPosition = "Top";
+               tabMargin = "7";
+               minTabWidth = "64";
+               tabHeight = "20";
+               allowReorder = "0";
+               defaultPage = "-1";
+               selectedPage = "0";
+               frontTabPadding = "0";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "12 11";
+               extent = "365 195";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBookProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+
+               new GuiTabPageCtrl(ppOptionsHDRBrightnessTab) {
+                  fitBook = "0";
+                  text = "Brightness";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "365 175";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "1";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings related to the brightness of the HDR postFX";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiSliderCtrl(ppOptionsHDRMinLuminance) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "132 77";
+                     extent = "206 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 0";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRKeyValue) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.0459184";
+                     position = "132 50";
+                     extent = "206 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 0.0459184";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRKeyValueLabel) {
+                     text = "Key Value";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "69 50";
+                     extent = "52 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The tone mapping middle grey or exposure value used to adjust the overall \"balance\" of the image.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRMinLuminanceLabel) {
+                     text = "Minimum Luminance";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "25 77";
+                     extent = "96 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The minimum luminance value to allow when tone mapping the scene. This is particularly useful if your scene is very dark or has a black ambient color in places.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRWhiteCutoffLabel) {
+                     text = "White Cutoff";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "56 104";
+                     extent = "65 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The cutoff level for the white levels in the brightness.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRWhiteCutoff) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.52551";
+                     position = "132 104";
+                     extent = "206 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 0.52551";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRBrightnessAdaptRate) {
+                     range = "0.1 10";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "2";
+                     position = "132 132";
+                     extent = "205 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRBrightnessAdaptRateLabel) {
+                     text = "Brightness Adapt Rate";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "12 132";
+                     extent = "109 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The speed at which the view adjusts to the new lighting in the environment.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRKeyValueLabel1) {
+                     text = "Tone Mapping Contrast";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "10 24";
+                     extent = "111 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Tone mapping contrast is the amount of scene to blend, with the tone mapped HDR scene. Lower values are recommended but higher values give a strong contrasted darker shadowed look.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRToneMappingAmount) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.265306";
+                     position = "132 24";
+                     extent = "206 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "value : 0.265306";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+               new GuiTabPageCtrl(ppOptionsHDRBloomTab) {
+                  fitBook = "0";
+                  text = "Bloom";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "365 175";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "0";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings related to the blooming aspect of the HDR postFX";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiSliderCtrl(ppOptionsHDRBloomBlurMultiplier) {
+                     range = "0 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.502645";
+                     position = "132 70";
+                     extent = "199 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 0.502645";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRBloomBlurMean) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.510526";
+                     position = "132 97";
+                     extent = "200 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 0.510526";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRBloomBlurStdDev) {
+                     range = "0 3";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "1.4127";
+                     position = "132 123";
+                     extent = "199 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 1.4127";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRBlurMultiplierLabel) {
+                     text = "Blur Multiplier";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "59 70";
+                     extent = "63 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The amount of blur to apply to the bloomed areas in the HDR.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRBlurMeanLabel) {
+                     text = "Blur \"mean\" value";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "38 97";
+                     extent = "84 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRBlurStandardDevianceLabel) {
+                     text = "Blur \"Std Dev\" value";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "23 123";
+                     extent = "99 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsHDRBloomBrightPassThresholdLabel) {
+                     text = "Bright pass threshold";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "19 43";
+                     extent = "103 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The bright pass threshold controls how bright the brightest areas of the scene are in the HDR.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsHDRBloomBlurBrightPassThreshold) {
+                     range = "0 5";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "1.60526";
+                     position = "132 43";
+                     extent = "200 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Value : 1.60526";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiCheckBoxCtrl(ppOptionsHDRBloom) {
+                     useInactiveState = "0";
+                     text = " Enable Bloom";
+                     groupNum = "-1";
+                     buttonType = "ToggleButton";
+                     useMouseEvents = "0";
+                     position = "250 9";
+                     extent = "85 24";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiCheckBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Enables or disables the bloom (glowing effect) of the HDR PostFX.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+               new GuiTabPageCtrl(ppOptionsHDRBloomEffectsTab) {
+                  fitBook = "0";
+                  text = "Effects";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "365 175";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "0";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings related to the effects the HDR postFX can offer";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiCheckBoxCtrl(ppOptionsHDREffectsBlueShift) {
+                     useInactiveState = "0";
+                     text = " Enable Color Shift";
+                     groupNum = "-1";
+                     buttonType = "ToggleButton";
+                     useMouseEvents = "0";
+                     position = "11 4";
+                     extent = "117 24";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiCheckBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Enables a scene tinting/Blue shift based on the color selected below.";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBlend) {
+                     baseColor = "1 0 0.0235294 1";
+                     pickColor = "0 0 0 1";
+                     selectorGap = "1";
+                     displayMode = "BlendColor";
+                     actionOnMove = "1";
+                     showReticle = "1";
+                     position = "10 29";
+                     extent = "344 110";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiDefaultProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Select a color";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBaseColor) {
+                     baseColor = "1 0 0.0235294 1";
+                     pickColor = "0 0 0 1";
+                     selectorGap = "1";
+                     displayMode = "HorizColor";
+                     actionOnMove = "1";
+                     showReticle = "1";
+                     position = "10 142";
+                     extent = "343 21";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiDefaultProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "Select a color";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+            };
+            new GuiCheckBoxCtrl(ppOptionsHDRToneMapping) {
+               useInactiveState = "0";
+               text = " Enable Tone Mapping";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "18 8";
+               extent = "120 24";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "0";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enables or disabled tone mapping on the HDR. The tone mapping balanced the brightness levels during the HDR process. Recommended";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiCheckBoxCtrl(ppOptionsEnableHDR) {
+               useInactiveState = "0";
+               text = "Enable";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "329 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enable/Disable the HDR postFX (takes some time to initialise, be patient)";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiCheckBoxCtrl(ppOptionsEnableHDRDebug) {
+               useInactiveState = "0";
+               text = "Debug";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "262 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+         new GuiTabPageCtrl(ppOptionsLightRaysTab) {
+            fitBook = "0";
+            text = "Light Rays";
+            maxLength = "1024";
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "1";
+            anchorLeft = "1";
+            anchorRight = "1";
+            position = "0 20";
+            extent = "394 213";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "0";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            tooltip = "Options for the Light Rays postFX";
+            hovertime = "1000";
+            isContainer = "1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+           new GuiSliderCtrl(ppOptionsLightRaysBrightScalar) {
+               range = "0 5";
+               ticks = "1000";
+               snap = "0";
+               value = "0.75";
+               position = "96 46";
+               extent = "264 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };			
+            new GuiTextCtrl(ppOptionsLightRaysBrightnessScalarLabel) {
+               text = "Brightness";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 48";
+               extent = "87 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls how bright the rays and the object casting them are in the scene.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+		    new GuiSliderCtrl(ppOptionsLightRaysSampleScalar) {
+               range = "20 512";
+               ticks = "512";
+               snap = "0";
+               value = "40";
+               position = "96 75";
+               extent = "264 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiTextCtrl(ppOptionsLightRaysSampleScalarLabel) {
+               text = "Samples";
+               maxLength = "512";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 76";
+               extent = "87 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls the number of samples for the shader.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiSliderCtrl(ppOptionsLightRaysDensityScalar) {
+               range = "0.01 1";
+               ticks = "1000";
+               snap = "0";
+               value = "0.94";
+               position = "96 105";
+               extent = "264 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiTextCtrl(ppOptionsLightRaysDensityScalarLabel) {
+               text = "Density";
+               maxLength = "1000";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 106";
+               extent = "87 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls the density of the rays.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiSliderCtrl(ppOptionsLightRaysWeightScalar) {
+               range = "0.1 10";
+               ticks = "1000";
+               snap = "0";
+               value = "5.65";
+               position = "96 135";
+               extent = "264 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiTextCtrl(ppOptionsLightRaysWeightScalarLabel) {
+               text = "Weight";
+               maxLength = "1000";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 136";
+               extent = "87 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls the weight of the rays.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			
+			new GuiSliderCtrl(ppOptionsLightRaysDecayScalar) {
+               range = "0.01 1";
+               ticks = "1000";
+               snap = "0";
+               value = "1.0";
+               position = "96 165";
+               extent = "264 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+			
+			new GuiTextCtrl(ppOptionsLightRaysDecayScalarLabel) {
+               text = "Decay";
+               maxLength = "1000";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 166";
+               extent = "87 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls the decay of the rays.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiCheckBoxCtrl(ppOptionsEnableLightRays) {
+               useInactiveState = "0";
+               text = "Enable";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "329 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enable/Disable the light rays postFX";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+         new GuiTabPageCtrl(ppOptionsDOFTab) {
+            fitBook = "0";
+            text = "DOF";
+            maxLength = "1024";
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "1";
+            anchorLeft = "1";
+            anchorRight = "1";
+            position = "0 20";
+            extent = "394 213";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "0";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            tooltip = "Options for the Depth Of Field postFX";
+            hovertime = "1000";
+            isContainer = "1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiBitmapBorderCtrl() {
+               position = "14 28";
+               extent = "362 170";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBorderProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "1";
+            };
+            new GuiTabBookCtrl() {
+               tabPosition = "Top";
+               tabMargin = "7";
+               minTabWidth = "64";
+               tabHeight = "20";
+               allowReorder = "0";
+               defaultPage = "-1";
+               selectedPage = "1";
+               frontTabPadding = "0";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "14 9";
+               extent = "360 189";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTabBookProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+
+               new GuiTabPageCtrl(ppOptionsDOFGeneralTab) {
+                  fitBook = "0";
+                  text = "General";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "360 169";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "0";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains general settings related to the DOF system";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  //new GuiCheckBoxCtrl(ppOptionsDOFEnableDOF) {
+                     //useInactiveState = "0";
+                     //text = "Enable DOF";
+                     //groupNum = "-1";
+                     //buttonType = "ToggleButton";
+                     //useMouseEvents = "0";
+                     //position = "31 43";
+                     //extent = "140 30";
+                     //minExtent = "8 2";
+                     //horizSizing = "right";
+                     //vertSizing = "bottom";
+                     //profile = "GuiCheckBoxProfile";
+                     //visible = "1";
+                     //active = "1";
+                     //tooltipProfile = "GuiToolTipProfile";
+                     //hovertime = "1000";
+                     //isContainer = "0";
+                     //canSave = "1";
+                     //canSaveDynamicFields = "0";
+                  //};
+                  new GuiCheckBoxCtrl(ppOptionsDOFEnableAutoFocus) {
+                     useInactiveState = "0";
+                     text = "Enable Auto Focus";
+                     groupNum = "-1";
+                     buttonType = "ToggleButton";
+                     useMouseEvents = "0";
+                     position = "31 8";
+                     extent = "140 30";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiCheckBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+               new GuiTabPageCtrl(ppOptionsDOFAutoFocusTab) {
+                  fitBook = "0";
+                  text = "Auto Focus";
+                  maxLength = "1024";
+                  docking = "Client";
+                  margin = "0 0 0 0";
+                  padding = "0 0 0 0";
+                  anchorTop = "1";
+                  anchorBottom = "1";
+                  anchorLeft = "1";
+                  anchorRight = "1";
+                  position = "0 20";
+                  extent = "360 169";
+                  minExtent = "8 2";
+                  horizSizing = "right";
+                  vertSizing = "bottom";
+                  profile = "GuiTabPageProfile";
+                  visible = "1";
+                  active = "1";
+                  tooltipProfile = "GuiToolTipProfile";
+                  tooltip = "Contains settings related to the fine control of the auto focus system";
+                  hovertime = "1000";
+                  isContainer = "1";
+                  canSave = "1";
+                  canSaveDynamicFields = "0";
+
+                  new GuiTextCtrl(ppOptionsDOFNearBlurMaxLabel) {
+                     text = "Near Blur Max";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "36 8";
+                     extent = "67 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The max allowed value of near blur";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFFarBlurMinSlider) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "120 8";
+                     extent = "224 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsDOFFarBlurMaxLabel) {
+                     text = "Far Blur Max";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "43 34";
+                     extent = "60 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The max allowed value of far blur";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFFarBlurMaxSlider) {
+                     range = "0 1";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "120 34";
+                     extent = "224 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsDOFFocusRangeMinLabel) {
+                     text = "Focus Range (Min)";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "13 61";
+                     extent = "90 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The distance range around the focal distance that remains in focus (in meters, minimum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFFocusRangeMinSlider) {
+                     range = "0.01 1e+003";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.01";
+                     position = "120 61";
+                     extent = "224 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsDOFFocusRangeMaxLabel) {
+                     text = "Focus Range (Max)";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "9 88";
+                     extent = "95 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "The distance range around the focal distance that remains in focus (in meters, maximum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFFocusRangeMaxSlider) {
+                     range = "0.01 1e+003";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0.01";
+                     position = "119 87";
+                     extent = "224 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsDOFBurCurveNearLabel) {
+                     text = "Blur Curve Near";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "27 114";
+                     extent = "77 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFBlurCurveNearSlider) {
+                     range = "0 50";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "119 114";
+                     extent = "225 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiTextCtrl(ppOptionsDOFBlurCurveFarLabel) {
+                     text = "Blur Curve Far";
+                     maxLength = "1024";
+                     margin = "0 0 0 0";
+                     padding = "0 0 0 0";
+                     anchorTop = "1";
+                     anchorBottom = "0";
+                     anchorLeft = "1";
+                     anchorRight = "0";
+                     position = "33 139";
+                     extent = "70 16";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiTextProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+                  new GuiSliderCtrl(ppOptionsDOFBlurCurveFarSlider) {
+                     range = "0 50";
+                     ticks = "1000";
+                     snap = "0";
+                     value = "0";
+                     position = "119 141";
+                     extent = "224 17";
+                     minExtent = "8 2";
+                     horizSizing = "right";
+                     vertSizing = "bottom";
+                     profile = "GuiSliderBoxProfile";
+                     visible = "1";
+                     active = "1";
+                     tooltipProfile = "GuiToolTipProfile";
+                     hovertime = "1000";
+                     isContainer = "0";
+                     canSave = "1";
+                     canSaveDynamicFields = "0";
+                  };
+               };
+            };
+            new GuiCheckBoxCtrl(ppOptionsEnableDOF) {
+               useInactiveState = "0";
+               text = "Enable";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "329 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enable/Disable the Depth of field postFX";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+         new GuiTabPageCtrl(ppOptionsVignetteTab) {
+            fitBook = "0";
+            text = "Vignette";
+            maxLength = "1024";
+            docking = "Client";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "1";
+            anchorLeft = "1";
+            anchorRight = "1";
+            position = "0 40";
+            extent = "394 193";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "1";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            tooltip = "Options for the Vignette postFX";
+            hovertime = "1000";
+            isContainer = "1";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+            Enabled = "1";
+
+            new GuiCheckBoxCtrl(ppOptionsEnableVignette) {
+               text = "Enable";
+               groupNum = "-1";
+               buttonType = "ToggleButton";
+               useMouseEvents = "0";
+               position = "329 7";
+               extent = "53 20";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiCheckBoxProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Enable/Disable the vignette postFX";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiSliderCtrl(ppOptionsVignetteVMax) {
+               range = "0.001 5";
+               ticks = "1000";
+               snap = "0";
+               value = "0.6";
+               position = "96 46";
+               extent = "221 17";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiSliderBoxProfile";
+               visible = "1";
+               active = "1";
+               variable = "$VignettePostEffect::VMax";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiTextCtrl(ppOptionsVignetteVMaxLabel) {
+               text = "Radius";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "26 48";
+               extent = "41 18";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               tooltip = "Controls the maximum exposure of vignetting.";
+               hovertime = "1000";
+               isContainer = "0";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+         new GuiTabPageCtrl() {
+            fitBook = "0";
+            text = "Color Correction";
+            maxLength = "1024";
+            margin = "0 0 0 0";
+            padding = "0 0 0 0";
+            anchorTop = "1";
+            anchorBottom = "0";
+            anchorLeft = "1";
+            anchorRight = "0";
+            position = "8 27";
+            extent = "376 200";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "GuiTabPageProfile";
+            visible = "1";
+            active = "1";
+            tooltipProfile = "GuiToolTipProfile";
+            hovertime = "1000";
+            isContainer = "1";
+            internalName = "ColorCorrectionTab";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+
+            new GuiTextCtrl() {
+               text = "Color Correction Ramp";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "6 7";
+               extent = "118 13";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiTextEditCtrl() {
+               historySize = "0";
+               tabComplete = "0";
+               sinkAllKeyEvents = "0";
+               password = "0";
+               passwordMask = "*";
+               text = "core/postFX/images/null_color_ramp.png";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "6 29";
+               extent = "365 18";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiTextEditProfile";
+               visible = "1";
+               active = "1";
+               altCommand = "ppColorCorrection_selectFileHandler( $thisControl.getText() );";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               internalName = "ColorCorrectionFileName";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiButtonCtrl() {
+               text = "Select...";
+               groupNum = "-1";
+               buttonType = "PushButton";
+               useMouseEvents = "0";
+               position = "252 54";
+               extent = "56 22";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiButtonProfile";
+               visible = "1";
+               active = "1";
+               command = "ppColorCorrection_selectFile();";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               internalName = "ColorCorrectionButton";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiButtonCtrl() {
+               text = "Reset";
+               groupNum = "-1";
+               buttonType = "PushButton";
+               useMouseEvents = "0";
+               position = "315 54";
+               extent = "56 22";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "GuiButtonProfile";
+               visible = "1";
+               active = "1";
+               command = "ppColorCorrection_selectFileHandler( \"\" );";
+               tooltipProfile = "GuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               internalName = "ColorCorrectionReset";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+         };
+      };
+      new GuiButtonCtrl(ppOptionsApply) {
+         text = "Apply";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         position = "309 302";
+         extent = "93 23";
+         minExtent = "8 8";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiButtonProfile";
+         visible = "1";
+         active = "1";
+         command = "PostFXManager.settingsApplyAll(); Canvas.popDialog(PostFXManager);";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Apply the settings and close this dialog";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiButtonCtrl(ppOptionsSavePreset) {
+         text = "Save Preset...";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         position = "111 302";
+         extent = "93 23";
+         minExtent = "8 8";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiButtonProfile";
+         visible = "1";
+         active = "1";
+         command = "PostFXManager.savePresetFile();";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Save the preset to a file to disk for later use (use postfx::applyPreset)";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiButtonCtrl(ppOptionsLoadPreset) {
+         text = "Load Preset...";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         position = "12 302";
+         extent = "93 23";
+         minExtent = "8 8";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiButtonProfile";
+         visible = "1";
+         active = "1";
+         command = "PostFXManager.loadPresetFile();";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Load a post FX preset file from disk";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiCheckBoxCtrl(ppOptionsEnable) {
+         useInactiveState = "0";
+         text = "Enable PostFX System";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         position = "13 24";
+         extent = "127 30";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiCheckBoxProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Enable or Disable the postFX system";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiPopUpMenuCtrl(ppOptionsQuality) {
+         maxPopupHeight = "200";
+         sbUsesNAColor = "0";
+         reverseTextList = "0";
+         bitmapBounds = "16 16";
+         maxLength = "1024";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "278 30";
+         extent = "122 21";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiPopUpMenuProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog.";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiTextCtrl(ppOptionsQualityLabel) {
+         text = "Quality";
+         maxLength = "1024";
+         margin = "0 0 0 0";
+         padding = "0 0 0 0";
+         anchorTop = "1";
+         anchorBottom = "0";
+         anchorLeft = "1";
+         anchorRight = "0";
+         position = "238 32";
+         extent = "39 12";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiTextProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog.";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+      new GuiButtonCtrl(ppOptionsOk1) {
+         text = "Revert";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         position = "210 302";
+         extent = "93 23";
+         minExtent = "8 8";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "GuiButtonProfile";
+         visible = "1";
+         active = "1";
+         command = "postProcessOptionsDlg.applySettings(); Canvas.popDialog(postProcessOptionsDlg);";
+         tooltipProfile = "GuiToolTipProfile";
+         tooltip = "Revert any changes made since opening the dialog";
+         hovertime = "1000";
+         isContainer = "0";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+      };
+   };
+};
+//--- OBJECT WRITE END ---

BIN
Templates/BaseGame/game/core/postFX/images/AreaMap33.dds


BIN
Templates/BaseGame/game/core/postFX/images/caustics_1.png


BIN
Templates/BaseGame/game/core/postFX/images/caustics_2.png


BIN
Templates/BaseGame/game/core/postFX/images/inactive-overlay.png


+ 32 - 0
Templates/BaseGame/game/core/postFX/images/materials.cs

@@ -0,0 +1,32 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2012 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+singleton Material( Empty )
+{
+};
+
+singleton Material(WarningMaterial) {
+   detailMap[0] = "missingTexture";
+   diffuseColor[0] = "25 16 0";
+   emissive[0] = false;
+   translucent = false;
+};

BIN
Templates/BaseGame/game/core/postFX/images/missingTexture.png


BIN
Templates/BaseGame/game/core/postFX/images/noise.png


Некоторые файлы не были показаны из-за большого количества измененных файлов