Game Configuration¶
Gsage engine has one global configuration file.
It is loaded by Gsage::GsageFacade::initialize()
.
This file has initial configs for all engine systems, plugins list, startup script path and data manager configuration.
It can be encoded in json and msgpack and can look like this:
{
"dataManager":
{
"extension": "json",
"charactersFolder": "characters",
"levelsFolder": "levels",
"savesFolder": "templates"
},
"startupScript": "scripts/start.lua",
"inputHandler": "ois",
"systems": ["ogre"],
"plugins":
[
"PlugIns/Plugin_ParticleUniverseFactory"
],
"packager": {
"deps": [
"tween"
]
},
"windowManager": {
"type": "SDL"
},
"render":
{
"pluginsFile": "plugins.cfg",
"configFile": "ogreConfig.cfg",
"globalResources":
{
"General":
[
"FileSystem:materials/",
"FileSystem:programs/",
"FileSystem:particles/PU",
"FileSystem:particles/Ogre"
],
"Rocket":
[
"FileSystem:fonts/",
"FileSystem:ui/"
]
},
"window":
{
"name": "Game",
"width": 1280,
"height": 800,
"params":
{
"FSAA": 4,
"displayFrequency": 50,
"vsync": false
}
}
}
}
Gsage::GameDataManager
Config¶
Gsage::GameDataManager
settings are stored in "dataManager"
section.
There can be 4 kinds of variables:
"extension"
extension of all data files."json"
is recommended."charactersFolder"
folder where to search characters construction data."levelsFolder"
folder where to search levels data."savesFolder"
folder where to keep saves.
Plugins List¶
"plugins"
stores list of plugins to be loaded on engine startup.
Plugins are c++ dynamic libraries: *.so/*.dylib/*.dll
.
Note
Plugin should be specified without extension. Engine will add appropriate extension for each platform itself.
Each defined plugin will be installed in the order defined in the list.
Systems Configs¶
Systems can be either registered statically, by calling Gsage::GsageFacade::addSystem()
or
they can be created by SystemFactory
in the runtime in GsageFacade::initialize
function.
SystemFactory
reads systems
array in the configration file. For example:
...
"systems": ["ogre", "lua", "dynamicStats"]
...
lua
anddynamicStats
are preinstalled systems.ogre
andrecast
are registered by the OgrePlugin.
Each system has two identifiers:
implementation id.
functional id.
Implementation id is used by SystemFactory
to create a system.
Functional id defines system purpose and is used to identify it’s components.
For example, there is render
system that is using ogre
underneath.
When the system is added to the engine it can read the configuration from the global configuration file. System configuration must be stored on the root level of global configuration file or scene file under functional id.
For example:
{
...
"movement": {
"cacheFolder": "./"
}
"coolSystem": {
"setMeUP": 1
}
...
}
Engine will inject each system configuration placed under system functional id.
The system will get a Gsage::DataProxy
object and will get all system specific parameters from it.
See Custom Systems for more information how to add new types of systems into Gsage engine.
Input¶
Input is configured by inputHandler
field.
It should have string identifier of input factory, which is installed into the Gsage Facade.
Currently it supports two kinds of inputHandlers:
SDL
(preferred).ois
(may be removed in future releases).
You can implement your own input handler and install it into the Gsage Facade. See Custom Input Handler to get more info how to implement your own input handler.
Window Management¶
windowManager
section can be used to configure window management system.
It has one mandatory field and one optional:
"type"
is mandatory and defines window manager type to use.
"windows"
is optional and may contain the list of windows that should be created by the window manager.
Elements of this list should be objects and may vary depending on the implementation fo the window manager.
Log Config¶
logConfig
can be used to define path to log configuration file.
Refer to easylogging++ documentation for more details.
Packager¶
This packager can install any lua dependencies using luarocks.
deps
array should contain the list of dependencies.
Each entry of this array support version pinning and version query operators.
Plug-Ins¶
Global config file can contain any additional configuration, which are relevant to installed plugins.