Set game directory listing to update every 30 mins, changed setting to GAME_DIRECTORY_LISTING and removed too verbose logging.
This commit is contained in:
parent
bc04d5f99e
commit
8f1378c47e
3 changed files with 39 additions and 34 deletions
|
|
@ -3,28 +3,28 @@
|
|||
Greg Taylor 2016
|
||||
|
||||
This contrib features a client for the [Evennia Game Directory]
|
||||
(http://evennia-game-directory.appspot.com/), a listing of games built on
|
||||
Evennia. By listing your game on the directory, you make it easy for other
|
||||
(http://evennia-game-directory.appspot.com/), a listing of games built on
|
||||
Evennia. By listing your game on the directory, you make it easy for other
|
||||
people in the community to discover your creation.
|
||||
|
||||
*Note: Since this is still an early experiment, there is no notion of
|
||||
ownership for a game listing. As a consequence, we rely on the good behavior
|
||||
of our users in the early goings. If the directory is a success, we'll work
|
||||
*Note: Since this is still an early experiment, there is no notion of
|
||||
ownership for a game listing. As a consequence, we rely on the good behavior
|
||||
of our users in the early goings. If the directory is a success, we'll work
|
||||
on remedying this.*
|
||||
|
||||
## Listing your Game
|
||||
|
||||
To list your game, you'll need to enable the Evennia Game Directory client.
|
||||
Start by `cd`'ing to your game directory. From there, open up
|
||||
`server/conf/server_services_plugins.py`. It might look something like this
|
||||
To list your game, you'll need to enable the Evennia Game Directory client.
|
||||
Start by `cd`'ing to your game directory. From there, open up
|
||||
`server/conf/server_services_plugins.py`. It might look something like this
|
||||
if you don't have any other optional add-ons enabled:
|
||||
|
||||
"""
|
||||
Server plugin services
|
||||
|
||||
|
||||
This plugin module can define user-created services for the Server to
|
||||
start.
|
||||
|
||||
|
||||
This module must handle all imports and setups required to start a
|
||||
twisted service (see examples in evennia.server.server). It must also
|
||||
contain a function start_plugin_services(application). Evennia will
|
||||
|
|
@ -32,26 +32,26 @@ if you don't have any other optional add-ons enabled:
|
|||
can be added to it). The function should not return anything. Plugin
|
||||
services are started last in the Server startup process.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
def start_plugin_services(server):
|
||||
"""
|
||||
This hook is called by Evennia, last in the Server startup process.
|
||||
|
||||
|
||||
server - a reference to the main server application.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
|
||||
To enable the client, import `EvenniaGameDirService` and fire it up after the
|
||||
Evennia server has finished starting:
|
||||
|
||||
"""
|
||||
Server plugin services
|
||||
|
||||
|
||||
This plugin module can define user-created services for the Server to
|
||||
start.
|
||||
|
||||
|
||||
This module must handle all imports and setups required to start a
|
||||
twisted service (see examples in evennia.server.server). It must also
|
||||
contain a function start_plugin_services(application). Evennia will
|
||||
|
|
@ -59,13 +59,13 @@ Evennia server has finished starting:
|
|||
can be added to it). The function should not return anything. Plugin
|
||||
services are started last in the Server startup process.
|
||||
"""
|
||||
|
||||
from evennia.contrib.gamedir_client import EvenniaGameDirService
|
||||
|
||||
|
||||
|
||||
def start_plugin_services(server):
|
||||
"""
|
||||
This hook is called by Evennia, last in the Server startup process.
|
||||
|
||||
|
||||
server - a reference to the main server application.
|
||||
"""
|
||||
gamedir_service = EvenniaGameDirService()
|
||||
|
|
@ -74,12 +74,12 @@ Evennia server has finished starting:
|
|||
|
||||
Next, configure your game listing by opening up `server/conf/settings.py` and
|
||||
using the following as a starting point:
|
||||
|
||||
|
||||
######################################################################
|
||||
# Contrib config
|
||||
######################################################################
|
||||
|
||||
GAMEDIR_CLIENT = {
|
||||
|
||||
GAME_DIRECTORY_LISTING = {
|
||||
'game_status': 'pre-alpha',
|
||||
'listing_contact': 'me@my-game.com',
|
||||
'telnet_hostname': 'my-game.com',
|
||||
|
|
@ -88,11 +88,11 @@ Next, configure your game listing by opening up `server/conf/settings.py` and
|
|||
|
||||
The following section in this README.md will go over all possible values.
|
||||
|
||||
At this point, you should be all set! Simply restart your game and check the
|
||||
server logs for errors. Your listing and some game state will be sent every
|
||||
At this point, you should be all set! Simply restart your game and check the
|
||||
server logs for errors. Your listing and some game state will be sent every
|
||||
half hour.
|
||||
|
||||
## Possible GAMEDIR_CLIENT settings
|
||||
## Possible GAMEDIR_DIRECTORY_LISTING settings
|
||||
|
||||
### game_status
|
||||
|
||||
|
|
@ -128,12 +128,12 @@ The port that the players can telnet into to play your game.
|
|||
|
||||
## What information is being reported?
|
||||
|
||||
In addition the the details listed in the previous section, we send some
|
||||
simple usage stats that don't currently get displayed. These will help the
|
||||
Evennia maintainers get a feel for some technical specifics for games out in
|
||||
the wild.
|
||||
In addition the the details listed in the previous section, we send some
|
||||
simple usage stats that don't currently get displayed. These will help the
|
||||
Evennia maintainers get a feel for some technical specifics for games out in
|
||||
the wild.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you don't see your game appear on the listing, check your server logs. You
|
||||
should see some error messages.
|
||||
should see some error messages.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class EvenniaGameDirClient(object):
|
|||
self.report_host = 'http://evennia-game-directory.appspot.com'
|
||||
self.report_path = '/api/v1/game/check_in'
|
||||
self.report_url = self.report_host + self.report_path
|
||||
self.logged_first_connect = False
|
||||
|
||||
self._on_bad_request = on_bad_request
|
||||
# Oh, the humanity. Silence the factory start/stop messages.
|
||||
|
|
@ -43,8 +44,10 @@ class EvenniaGameDirClient(object):
|
|||
"""
|
||||
status_code, response_body = yield self._form_and_send_request()
|
||||
if status_code == 200:
|
||||
logger.log_infomsg(
|
||||
"Successfully sent game details to Evennia Game Directory.")
|
||||
if not self.logged_first_connect:
|
||||
logger.log_infomsg(
|
||||
"Successfully sent game details to Evennia Game Directory.")
|
||||
self.logged_first_connect = True
|
||||
return
|
||||
# At this point, either EGD is having issues or the payload we sent
|
||||
# is improperly formed (probably due to mis-configuration).
|
||||
|
|
@ -64,7 +67,7 @@ class EvenniaGameDirClient(object):
|
|||
'User-Agent': ['Evennia Game Directory Client'],
|
||||
'Content-Type': ['application/x-www-form-urlencoded'],
|
||||
}
|
||||
gd_config = settings.GAMEDIR_CLIENT
|
||||
gd_config = settings.GAME_DIRECTORY_LISTING
|
||||
values = {
|
||||
'game_name': settings.SERVERNAME,
|
||||
'game_status': gd_config['game_status'],
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ from twisted.internet.task import LoopingCall
|
|||
from evennia.contrib.gamedir_client.client import EvenniaGameDirClient
|
||||
from evennia.utils import logger
|
||||
|
||||
# How often to sync to the server
|
||||
_CLIENT_UPDATE_RATE = 60 * 30
|
||||
|
||||
class EvenniaGameDirService(Service):
|
||||
"""
|
||||
|
|
@ -20,7 +22,7 @@ class EvenniaGameDirService(Service):
|
|||
def startService(self):
|
||||
super(EvenniaGameDirService, self).startService()
|
||||
# TODO: Check to make sure that the client is configured.
|
||||
self.loop.start(10)
|
||||
self.loop.start(_CLIENT_UPDATE_RATE)
|
||||
|
||||
def stopService(self):
|
||||
if self.running == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue