Table of Contents
Services are scripted objects that are similar to base-only entities. They are designed to integrate additional functionality with the game server. This functionality typically involves external processes.
Each service type is implemented as a collection of Python scripts,
and an XML-based definition file that ties the scripts together. These
scripts are located in the resource tree under the folder scripts
(i.e.,
, where <res>
/scripts
<res>
is the virtual
tree defined ~/.bwmachined.conf
).
The list below summarises the important files and directories for
services in <res>
:
-
<res>
‐ Resource tree defined in~/.bwmachined.conf
.-
scripts ‐ Folder containing all service files.
-
services.xml
‐ Lists all services to load into the server at start-up time. -
base ‐ Folder contains Python scripts for entities with a base component.
-
common ‐ Folder listed in the Python search path for all components. Used for common game code.
-
lib ‐ Folder listed in the Python search path for all components. Used for common game code.
-
-
service ‐ Folder contains Python scripts for services to be run on ServiceApps.
-
service_defs ‐ Contains an XML
.def
file for each service listed in file
.<res>
/scripts/services.xml-
‐ Service definition file. There is one such file for each service defined in<service>
.def<res>
/scripts/services.xml.
-
-
-
The file
is used by the BigWorld engine to determine the types of services
available for use.
<res>
/scripts/services.xml
The file contains a list of Services as elements, as children of the
root
node:
<root> <Service1/> <Service2/> </root>
The service definition file
determines how your scripts communicate in BigWorld. This allows the
BigWorld system to abstract the tasks of sending and receiving messages
into simply calling different script methods on your services. In a sense,
the definition file provides an interface to your service, and the Python
scripts provide the implementation.
<res>
/scripts/service_defs/<service>
.def
Each service type has a corresponding definition file, named after
the service's type name followed by the extension '.def
'. For example, a
NoteStore
service type would have a file called
NoteStore.def
.
The following file is a 'minimal' service definition file, to aid in quickly defining a new service:
<root> <Methods><!-- declaration --> </Methods> </root>
‐ Minimal service definition
file<res>/
scripts/service_defs/<service>
.def
For details, see Methods. |
BigWorld Technology handles the processing of all services in the Service execution context. Therefore, a script file for each service type is provided for this context.
For example, a NoteStore
service will have
one script file with the implementation of the class, located at
<res>
/scripts/service/NoteStore.py
The service's base class defined in the script file is
BigWorld.Service
, since the file represents the
Service execution context.
The start of the script for a NoteStore
service could be implemented as below:
import BigWorld class NoteStore( BigWorld.Service ): def __init__( self ): BigWorld.Service.__init__( self )
NoteStore.py
‐ Service script
file<res>/
scripts/service/