Creates game servers, offline games or demo playbacks. More...
#include <gamehost.h>
Public Member Functions | |
GameHost (EnginePlugin *plugin) | |
Message | createHostCommandLine (const GameCreateParams ¶ms, CommandLineInfo &cmdLine) |
Message | host (const GameCreateParams ¶ms) |
EnginePlugin * | plugin () const |
EnginePlugin that this GameHost is associated with. More... | |
Protected Member Functions | |
virtual void | addCustomParameters () |
"Custom parameters" are specified directly by user in "Create Game" dialog box. More... | |
void | addDMFlags () |
[Virtual] Creates engine specific command line parameters out of passed DM flags list. More... | |
void | addDMFlags_default () |
virtual void | addExtra () |
Creates engine specific command line parameters out of Server class fields. More... | |
void | addGlobalGameCustomParameters () |
[Virtual] Adds custom parameters as defined in Doomseeker's configuration box. More... | |
void | addGlobalGameCustomParameters_default () |
void | addIwad () |
[Virtual] Loads IWAD. More... | |
void | addIwad_default () |
void | addPwads () |
[Virtual] Loads PWADs and other mod files (dehacked patches, pk3s, etc.) More... | |
void | addPwads_default () |
void | addPwads_prefixOnce () |
See: GameClientRunner::addModFiles_prefixOnce() More... | |
const QString & | argForBexLoading () const |
Command line parameter that is used to load a BEX file. More... | |
const QString & | argForDehLoading () const |
Command line parameter that is used to load a DEHACKED file. More... | |
const QString & | argForDemoPlayback () const |
Command line parameter for playing back a demo. More... | |
const QString & | argForDemoRecord () const |
Command line parameter for recording a demo. More... | |
const QString & | argForIwadLoading () const |
Command line parameter that is used to set IWAD. More... | |
const QString & | argForOptionalWadLoading () const |
Command line parameter that is used to load optional WADs. More... | |
const QString & | argForPort () const |
Command line parameter that is used to set network port for the game. More... | |
const QString & | argForPwadLoading () const |
Command line parameter that is used to load a PWAD. More... | |
const QString & | argForServerLaunch () const |
Command line parameter used to launch a server. More... | |
QStringList & | args () |
Reference to command line arguments. More... | |
virtual void | createCommandLineArguments () |
Builds command line arguments sequentially by calling other methods. More... | |
const GameCreateParams & | params () const |
GameCreateParams with which this game should be configured. More... | |
void | setArgForBexLoading (const QString &arg) |
void | setArgForDehLoading (const QString &arg) |
void | setArgForDemoPlayback (const QString &arg) |
void | setArgForDemoRecord (const QString &arg) |
void | setArgForIwadLoading (const QString &arg) |
void | setArgForOptionalWadLoading (const QString &arg) |
void | setArgForPort (const QString &arg) |
void | setArgForPwadLoading (const QString &arg) |
void | setArgForServerLaunch (const QString &arg) |
void | setMessage (const Message &message) |
Call this method to convey errors. More... | |
bool | verifyPwadPaths () |
Verifies if all params().pwadsPaths() exist. More... | |
Creates game servers, offline games or demo playbacks.
GameHost launches games from the perspective of the "server admin" or "game master" or "local player" (whatever is appropriate in given circumstances). It works in close union with GameCreateParams which basically tells GameHost how to configure the game. This structure can be accessed at any time with params() method.
Game launch command line is built by sequentially executing add*() methods. Each of these methods is allowed to set error and bail early by setting appropriate Message with setMessage() method. Reference to command line arguments list can be accessed with args(). This points to a QStringList that can be manipulated freely.
Some configuration settings are universal between Doom game engines. Default GameHost implementation will try to handle them, so plugins don't need to build everything from scratch. Sometimes different engines handle the same type of configuration using different argument. This can include operations like loading PWADs or dehacked files, or playing back a demo. You can customize this argument by setting args returned by arg*() methods. Each arg*() method has an equivalent setArg*() method. For example, argForPort() has setArgForPort(). The best place to call setArg*() methods and configure these properties is the constructor of the subclass defined in the plugin.
Configuration settings that aren't universal need to be added by overriding addExtra() method.
Definition at line 69 of file gamehost.h.
|
protectedvirtual |
"Custom parameters" are specified directly by user in "Create Game" dialog box.
Definition at line 102 of file gamehost.cpp.
|
protected |
[Virtual] Creates engine specific command line parameters out of passed DM flags list.
Default behavior does nothing.
|
protectedvirtual |
Creates engine specific command line parameters out of Server class fields.
Following settings are already set by default implementation of createHostCommandLine() and don't need any additional handling:
Definition at line 130 of file gamehost.cpp.
|
protected |
[Virtual] Adds custom parameters as defined in Doomseeker's configuration box.
These parameters are added at the very beginning of the command line.
|
protected |
[Virtual] Loads IWAD.
|
protected |
[Virtual] Loads PWADs and other mod files (dehacked patches, pk3s, etc.)
|
protected |
See: GameClientRunner::addModFiles_prefixOnce()
Definition at line 173 of file gamehost.cpp.
|
protected |
Command line parameter that is used to load a BEX file.
Default: "-deh".
Definition at line 216 of file gamehost.cpp.
|
protected |
Command line parameter that is used to load a DEHACKED file.
Default: "-deh".
Definition at line 221 of file gamehost.cpp.
|
protected |
Command line parameter for playing back a demo.
Default: "-playdemo".
Definition at line 246 of file gamehost.cpp.
|
protected |
Command line parameter for recording a demo.
Default: "-record";
Definition at line 251 of file gamehost.cpp.
|
protected |
Command line parameter that is used to set IWAD.
Default: "-iwad".
Definition at line 226 of file gamehost.cpp.
|
protected |
Command line parameter that is used to load optional WADs.
Default: "-file".
Definition at line 231 of file gamehost.cpp.
|
protected |
Command line parameter that is used to set network port for the game.
Default: "-port".
Definition at line 236 of file gamehost.cpp.
|
protected |
Command line parameter that is used to load a PWAD.
Default: "-file".
Definition at line 241 of file gamehost.cpp.
|
protected |
Command line parameter used to launch a server.
No default.
Definition at line 256 of file gamehost.cpp.
|
protected |
Reference to command line arguments.
This is where plugins should write all CMD line arguments they create for the executable run.
Definition at line 261 of file gamehost.cpp.
|
protectedvirtual |
Builds command line arguments sequentially by calling other methods.
This can be overridden if the default behavior does the completely wrong thing. In most cases however this method should be left untouched and appropriate add*() methods should be overridden instead, or appropriate arg*() properties should be configured.
Definition at line 266 of file gamehost.cpp.
Message GameHost::createHostCommandLine | ( | const GameCreateParams & | params, |
CommandLineInfo & | cmdLine | ||
) |
Definition at line 303 of file gamehost.cpp.
Message GameHost::host | ( | const GameCreateParams & | params | ) |
Definition at line 321 of file gamehost.cpp.
|
protected |
GameCreateParams with which this game should be configured.
Definition at line 353 of file gamehost.cpp.
EnginePlugin * GameHost::plugin | ( | ) | const |
EnginePlugin that this GameHost is associated with.
Definition at line 358 of file gamehost.cpp.
|
protected |
Call this method to convey errors.
GameHost checks for errors before making certain steps. If plugins want to prevent execution of the game, they should set a Message instance that will return 'true' on Message::isError().
Definition at line 417 of file gamehost.cpp.
|
protected |
Verifies if all params().pwadsPaths()
exist.
If at least one path points to a non-existing file, an error message is set through setMessage() and false is returned. If all paths are fine, true is returned.
Called by addPwads_default() and addPwads_prefixOnce().
Definition at line 435 of file gamehost.cpp.