Merge pull request #2272 from Areloch/CoreModuleification

Core module-ification
This commit is contained in:
Areloch 2018-10-12 00:39:48 -05:00 committed by GitHub
commit 2721732b5c
427 changed files with 482 additions and 230 deletions

View file

@ -0,0 +1,143 @@
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_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" );
}

View file

@ -1,11 +1,11 @@
<ModuleDefinition
ModuleId="CoreComponentsModule"
ModuleId="CoreModule"
VersionId="1"
Description="Module that implements the core engine-level components for the game."
ScriptFile="CoreComponents.cs"
Description="Module that implements the core engine-level setup for the game."
ScriptFile="Core.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy"
Group="Game">
Group="Core">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"

View file

@ -1,10 +0,0 @@
function CoreComponentsModule::onCreate(%this)
{
%classList = enumerateConsoleClasses( "Component" );
foreach$( %componentClass in %classList )
{
echo("Native Component of type: " @ %componentClass);
}
}

View file

@ -12,7 +12,7 @@
// 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 ClientServer::create( %this )
function Core_ClientServer::create( %this )
{
echo("\n--------- Initializing Directory: scripts ---------");
exec( "./scripts/client/client.cs" );
@ -35,7 +35,7 @@ function ClientServer::create( %this )
}
}
function ClientServer::destroy( %this )
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

View file

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

View file

@ -9,10 +9,10 @@ function initClient()
$Client::GameTypeQuery = $appName;
$Client::MissionTypeQuery = "Any";
exec( "data/clientServer/scripts/client/message.cs" );
exec( "data/clientServer/scripts/client/connectionToServer.cs" );
exec( "data/clientServer/scripts/client/levelDownload.cs" );
exec( "data/clientServer/scripts/client/levelLoad.cs" );
exec( "./message.cs" );
exec( "./connectionToServer.cs" );
exec( "./levelDownload.cs" );
exec( "./levelLoad.cs" );
//load prefs
%prefPath = getPrefpath();

View file

@ -27,21 +27,21 @@ function initServer()
//load prefs
//Force-load the defaults just so we don't have any mistakes
exec( "data/clientServer/scripts/server/defaults.cs" );
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( "data/clientServer/scripts/server/audio.cs" );
exec( "data/clientServer/scripts/server/commands.cs" );
exec( "data/clientServer/scripts/server/kickban.cs" );
exec( "data/clientServer/scripts/server/message.cs" );
exec( "data/clientServer/scripts/server/levelDownload.cs" );
exec( "data/clientServer/scripts/server/levelLoad.cs" );
exec( "data/clientServer/scripts/server/levelInfo.cs" );
exec( "data/clientServer/scripts/server/connectionToClient.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.

View file

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

View file

@ -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>

View file

@ -1,8 +0,0 @@
<ComponentAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="CollisionComponentAsset"
componentClass="CollisionComponent"
friendlyName="Collision"
componentType="Collision"
description="Enables an entity to collide with things." />

View file

@ -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" />

View file

@ -6,4 +6,4 @@
friendlyName="Camera"
componentType="Game"
description="Allows the component owner to operate as a camera."
scriptFile="core/components/game/camera.cs" />
scriptFile="core/components/components/game/camera.cs" />

View file

@ -7,4 +7,4 @@
friendlyName="Control Object"
componentType="Game"
description="Allows the component owner to be controlled by a client."
scriptFile="core/components/game/controlObject.cs" />
scriptFile="core/components/components/game/controlObject.cs" />

View file

@ -7,4 +7,4 @@
friendlyName="Item Rotation"
componentType="Game"
description="Rotates the entity around an axis, like an item pickup."
scriptFile="core/components/game/itemRotate.cs" />
scriptFile="core/components/components/game/itemRotate.cs" />

View file

@ -7,4 +7,4 @@
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/game/playerSpawner.cs" />
scriptFile="core/components/components/game/playerSpawner.cs" />

View file

@ -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." />

View file

@ -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)
{
}

View file

@ -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>

View file

@ -20,9 +20,6 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
exec("./profiles.cs");
exec("./console.gui");
GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
function ConsoleEntry::eval()

View file

@ -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)
{
}

View file

@ -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>

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View file

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 635 B

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

View file

Before

Width:  |  Height:  |  Size: 778 B

After

Width:  |  Height:  |  Size: 778 B

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -107,7 +107,7 @@ new GuiControlProfile (GuiWindowProfile)
bevelColorHL = "255 255 255";
bevelColorLL = "0 0 0";
text = "untitled";
bitmap = "./images/window";
bitmap = "core/gui/images/window";
textOffset = "8 4";
hasBitmapArray = true;
justify = "left";
@ -119,7 +119,7 @@ if(!isObject(GuiTextEditProfile))
new GuiControlProfile(GuiTextEditProfile)
{
opaque = true;
bitmap = "./images/textEdit";
bitmap = "core/gui/images/textEdit";
hasBitmapArray = true;
border = -2;
fillColor = "242 241 240 0";
@ -145,7 +145,7 @@ new GuiControlProfile(GuiScrollProfile)
fontColor = "0 0 0";
fontColorHL = "150 150 150";
border = true;
bitmap = "./images/scrollBar";
bitmap = "core/gui/images/scrollBar";
hasBitmapArray = true;
category = "Core";
};
@ -173,7 +173,7 @@ new GuiControlProfile(GuiCheckBoxProfile)
fontColorNA = "200 200 200";
fixedExtent = true;
justify = "left";
bitmap = "./images/checkbox";
bitmap = "core/gui/images/checkbox";
hasBitmapArray = true;
category = "Tools";
};
@ -193,7 +193,7 @@ new GuiControlProfile( GuiProgressBitmapProfile )
{
border = false;
hasBitmapArray = true;
bitmap = "./images/loadingbar";
bitmap = "core/gui/images/loadingbar";
category = "Core";
};
@ -220,7 +220,7 @@ new GuiControlProfile( GuiButtonProfile )
fixedExtent = false;
justify = "center";
canKeyFocus = false;
bitmap = "./images/button";
bitmap = "core/gui/images/button";
hasBitmapArray = false;
category = "Core";
};

View file

@ -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)
{
}

View file

@ -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>

View file

@ -39,8 +39,8 @@ $pref::LightManager::sgUseDynamicShadows = "1";
$pref::LightManager::sgUseToneMapping = "";
*/
exec( "./shaders.cs" );
exec( "./deferredShading.cs" );
//exec( "./shaders.cs" );
//exec( "./deferredShading.cs" );
function onActivateAdvancedLM()
{

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
exec( "./shadowFilter.cs" );
//exec( "./shadowFilter.cs" );
singleton GFXStateBlockData( BL_ProjectedShadowSBData )
{

View file

@ -26,12 +26,12 @@ function initLightingSystems(%manager)
// First exec the scripts for the different light managers
// in the lighting folder.
%pattern = "./lighting/*/init.cs";
/*%pattern = "./lighting/*//*init.cs";
%file = findFirstFile( %pattern );
if ( %file $= "" )
{
// Try for DSOs next.
%pattern = "./lighting/*/init.cs.dso";
%pattern = "./lighting/*//*init.cs.dso";
%file = findFirstFile( %pattern );
}
@ -39,7 +39,7 @@ function initLightingSystems(%manager)
{
exec( %file );
%file = findNextFile( %pattern );
}
}*/
// Try the perfered one first.
%success = setLightManager(%manager);

View file

@ -1,99 +0,0 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// 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.
// ----------------------------------------------------------------------------
//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";
ModuleDatabase.setModuleExtension("module");
//Core components
ModuleDatabase.scanModules( "core", false );
ModuleDatabase.LoadExplicit( "CoreComponentsModule" );
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
%prefPath = getPrefpath();
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
exec( %prefPath @ "/clientPrefs.cs" );
else
exec("data/defaults.cs");
%der = $pref::Video::displayDevice;
// 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();

View file

@ -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)
{
}

View file

@ -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>

View file

@ -2526,7 +2526,7 @@
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "core/images/null_color_ramp.png";
text = "core/postFX/images/null_color_ramp.png";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Some files were not shown because too many files have changed in this diff Show more