This article describes how to make your game to produce a standard RSS feed with the main in-game events. The RSS feed can be either used by followrs like it is, or it can be piped to other Web 2.0 services and websites such as Facebook, Twitter, etc.
Why producing an RSS feed is so important
It takes much effort to let people to enter and try out your game. Normally you want your visitors to come back, and play more. An RSS feed is a simple and yet standard device to let people outside the game to stay informed about what happen inside the game. Thanks to popular Web 2.0 services such as Facebook and Twitter, by publishing important in-game event news you stimulate new user's curiosity and make them enter and try out your game, thus making it more viral.
This technique, also, is the basis for our DimensioneX-to-Facebook kit, which can turn any DimensioneX-powered game into a full-fledged Facebook App. This aspect will be dealt in another tutorial.
So, you want to create an RSS, just read on.
What is an RSS feed
In brief, here is what it takes to have your game's RSS feed up and working:
- Authorize your game to write a Journal file on your game server
- Place Journal instructions in the game, at specific (and important) in-game events
- Transform the journal file to a standard RSS feed by using our PHP script (or write your own)
- Publicize the feed to your users
- (optional) pipe the feed to popular services: FeedBurner, Twitter, Facebook
Step 1 - Update your game engine
First, verify you are running an updated version of DimensioneX. The DimensioneX version is displayed on the connect screen of your own game ("built with DimensioneX ...") it should be at least 6.4.9
If the game engine is not updated, then the Journal instruction won't be available.
Step 2 - Authorize creation of the Journal file
DimensioneX is designed for server safety so it will never let the game developer to write files on the server without authorization. So before your game can write the journal file, this must be authorized.
Open your game's settings file (worldnavNN.properties in the dimx/WEB-INF/system directory) and add this line (if the setting is already there, just edit it):
# # journal # Path of a local file for producing RSS # e.g. C:/journal.txt journal=C:/journal.txt
In this setting you tell the game engine where the journal file will be created and how to call it. Here we chose to create it on the C: drive, root folder and name it journal.txt. Adjust the value to your own preference. Save, close, next step.
Step 3 - Insert Journal instruction in the game
Just for getting the things started, we can place a Journal instruction in a frequently called point of the game code so that we can easily see if it works.
Let's open your game (if you don't have one, just pick one out of the DimensioneX kit) and insert this event code:
EVENT onNew Print "Hello!" Journal "New player!",gameinfo("site"),"A new player named: " & $AGENT.name & " has entered the game","user:" & $AGENT.name END_EVENT
If the game already has got an event named onNew, you can just insert the Journal instruction.
Let's now start the DimensioneX game engine, and enter in the game.
If everything worked fine, you should see a "Hello!" string on the game view.
Now check out your hard disk drive, where you configured the journal file to be written (it was C: drive, root folder, in the above step).
A journal.txt file should be there.
If you open it with a text editor you should be able to see the contents, there should be some text inside.
The juornal file is a sort of RSS feed itself written in a proprietary text format.
Now we just need to set up a tool which will convert it on-the-fly. See next step.
Step 4 - Installing the Journal-to-RSS converter
Unpack the ZIP and copy the grss.php file onto your own webserver.
Step 5 - Configure grss.php
The configuration section is at the top of the file.
// CONFIG HERE $gamewebsite = 'http://www.gamesite.net/'; // URL to game's official web site (used in RSS feed) $gamedescr = 'Your great MMORPG game'; // (brief) game description to be used in game RSS feed $journalfile = 'http://www.dimensionex.net/journal/journal.txt'; // Path to journal file. Can be an URL starting with http:// OR local file path (absolute or relative) eg. ../private/journal5.txt $feedtitle = 'MMORPG Game Feed'; // Human-readable title for Game events RSS Feed $feedurl = 'http://www.gamesite.net/grss.php'; // URL to Game events RSS Feed (this script) $debugmode = FALSE; // Set to TRUE to see diagnostic messages // STOP CONFIG!
The settings are commented so it should not be difficult to figure out what values they need to be filled with.
$journalfile: Specify here how to reach the game's journal file on the internet (use a full URL starting with http:// in this case) OR a file on the local filesystem; this path can be relative from the folder where grss.php is located. You can either specify a relative path or an absolute one.
For a test, you can leave the pre-configured address - you will get a sample journal file from Underworld Online.
Step 6 - Call the grss.php file from the web
Opening the script via the web, so:
Voilà, you should be able to see your game events, in a perfect RSS format.
htaccess shorthand recipe
As an optional step, if have an Apache webserver and if you like to, you can edit your .htaccess file so that the game feed is accessible via a different, simpler and cleaner URL that hides the real script's name. For example, at http://www.underworld-game.net I have edited the .htaccess file:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^game-feed$ grss.php [L] </IfModule>
So that you can access the feed via: http://www.underworld-game.net/game-feed
Step 7 - Publicize / Distribute
It is now time to publicize your game feed to the game target users.
Before you do this, you should be aware that FeedBurner.com offers for free the possiblity to enhance your game feed with sharing tools, extra gadgets and (important!) provide you usage statistics about how many users have subscribed to the feed, how many items are being clicked, etc.
If you are interested, just go to http://www.feedburner.com , get the service (it is a Google account based free service) and follow on-screen instructions to "burn" your feed. At the end of the process, you will be given a new, feedburned URL to be used and distributed to final users.
For example, my Underworld Online game feed has been transformed by Feedburner from this:
On your game site
It's a good practice to place, in the <HEAD> section of each page of your site, a showing the browser where the game feed is. here is an example that you can copy and customize for your own case:
<link rel="alternate" type="application/rss+xml" title="Underworld Free MMORPG Game Feed" href="http://feeds.feedburner.com/UnderworldOnlineGameFeed" />
Of course you have to customize the TITLE and HREF attributes of the tag.
Please note that this tag works for the browser's "Subscribe" function. Adding an icon with a normal link to the feed for human users to click on, is another must-have. If you look at http://ww.underworld-game.net you will find these icons in the right side bar.
Piping to Twitter and Facebook
To squeeze the maximum benefit out from it, you can echo your RSS contents on Twitter and Facebook.
Of course you need a Twitter account and a Facebook account for this.
About Facebook, creating your game's official Facebook page is a good idea before proceeding. Once you've got your Facebook profile, to start your own page you can find a link to do it on any FB page, one is here: http://www.facebook.com/pages/Underworld-Fantasy-Mmorpg/178092325555661 just click the Create a new page link in the left sidebar and follow on screen instructions.
Let's proceed with the piping techinque details.
The best way to do this is using http://www.twitterfeed.com Create a free account, enter your feed eddress (not the feedburner url, the real, clean one!) then follow on screen instructions to select the services you want to publish to.
You can select both Twitter and Facebook, set the frequency of the updates (max 30 mins) choose how many posts you want to publish for each update. For Facebook you will be prompted whether to publish on your own profile wall, or on one of your facebook pages (see above).
The good point about Twitterfeed is that with one free account you can handle many feeds, and that the max update frequency is 30 minutes, which is OK for most purposes.
For completeness, I will mention here also http://www.hootsuite.com , it is similar although it handles just 2 social network accounts without paying, and that the max update frequency is 1 hr, which is too low for my liking.
We have shown in this tutorial how you can easily produce an RSS feed out of your in-game events and distribute it to users even using Twitter and Facebook.
If you have comments or updates on this script, please post on our forum.
If you liked this, don't miss next tutorial about the DimensioneX-to-Facebook kit, a package of PHP scripts which turns any DimensioneX-powered game into a fully qualified, viral Facebook App.
- back to DimensioneX WIKI main