Getting Started With MongoDB (Python)
Now that I’ve extolled the virtues of using a NoSQL database, it’s time to put my money where my mouth is and show you how to use one.
To start things off, we’re going to build a super-simple site using the excellent Bottle Python framework, which is built for building simple sites like this.
This tutorial assumes that you already have a mongoDB instance up and running somewhere; if you haven’t done that already, take a look at the quickstart on mongodb.org.
First, download and install Bottle (it’s pretty easy). Once that’s done, we can start working on building our mini project.
Today we’re going to build a small ‘army manager’ site; users will be able to add, edit, and delete members of their army, and everything we need to track for the user will be stored in our mongodb database.
To start off, we’ll just make the index page return a template:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import bottle, random from bottle import route, jinja2_view as view, debug, run DATABASE_HOST = 'localhost' DATABASE_NAME = 'army' DATABASE_PORT = 27017 import pymongo from pymongo import Connection connection = Connection(DATABASE_HOST, DATABASE_PORT) db = connection[DATABASE_NAME] users = db.users SOLDIER_NAMES = ["Moe", "Curly", "Janne", "Peter", "Paul", "Kyle", "Chris", "Jude", "Larry", "Gus"] @route('/') @view('templates/index.html') def index(): current_user = get_current_user() return { 'user': current_user, } def get_current_user(): ip = request.environ['REMOTE_ADDR'] current_user = users.find_one({'ip': ip}) if not current_user: users.insert({ 'ip': ip, 'army': [], }) current_user = users.find_one({'ip': ip}) return current_user if __name__ == '__main__': debug(True) run(host='localhost', port=8000, reloader=True) |
You may have noticed that instead of using the default template renderer, I used the Jinja renderer instead – which templating engine you use is up to you, but I prefer Jinja.
There’s a lot going on here – and if you’re new to Python, this code probably looks pretty scary. However, it’s pretty simple once you get the hang of it – here’s what we’re doing:
-
First, we’re importing all of the libraries we need, and setting up some of our configuration. This could be split out into another file easily enough – but for the sake of this tutorial, we’re going to keep everything self-contained for now. The libraries and helpers we’ve imported are random, bottle.route, bottle.run, bottle.request, bottle.jinja2_view as view, bottle.response, bottle.debug, bottle.redirect, pymongo, and pymongo.Connection
Most of these come from the Bottle library, and are designed to help us get our app off the ground faster – we imported random to be able to choose names for our soldiers, and pymongo to help us work with our MongoDB database.
-
The next thing we did was create our index view – by saying that Bottle should route the url ‘/’ to our ‘index’ function. As you can see, all our index function does is retrieve the current user, and return it so that we can render it with our template – which we specified using our view() decorator.
-
The next thing we do is define a function to retrieve the current user, based on their IP address – this is our first dive into working with MongoDB. First, we retrieve the IP address of the computer that’s requesting the page, so that we can track the visitor’s information. Once we have that, we query our users database, to see if a user exists with our IP – if there is no user with the IP address we’re testing for, we create a new user with an empty army, and then return that one.
-
Finally, we have a little bit of utility code to let us test our Bottle app. This piece of code allows us to run our app by navigating to it in the terminal, and then just running “python app.py” – assuming your MongoDB instance is up and running and your dependencies are okay, you should be able to check out your app by navigating to http://localhost:8000/.
If you navigate to your app right now though, you might notice that there’s a problem – we don’t have an index template! We’ll fix that by creating a template for our app, under templates/index.html:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>Python MongoDB Tutorial</title> </head> <body> Your Army: {{ user.army }} <form action='/add-soldier/' method='post'> <input type="submit" value="Add Soldier" /> </form> <form action='/remove-soldier/' method='post'> <input type="submit" value="Remove Soldier" /> </form> <form action='/rename-army/' method='post'> <input type="submit" value="Rename All Soldiers" /> </form> </body> </html> |
As you can see, we’re not shattering any barriers with this template – but it lets us test our app, so it will do for now. Navigate again to http://localhost:8000/, and you should see something like this:
![Your Army: [], Add Soldier button, Remove Soldier button, Rename All Soldiers button](http://buildingbrowsergames.com/blog/wp-content/images/mongodb-python/first.png)
With our template all set up, it’s time to write our views – starting with the view that lets us add soldiers:
@route('/add-soldier/', method='POST') def add_soldier(): current_user = get_current_user() army = current_user.get('army', []) army.append(random.choice(SOLDIER_NAMES)) users.update( {'ip': current_user['ip']}, {'$set': { 'army': army, }} ) redirect('/')
For the most part, this view’s pretty simple – we want it to be at the url ‘/add-soldier/’, and only responding when users POST to it (by clicking on the ‘add soldier’ button in our template). When a user clicks on the button and POSTs to this view, we retrieve their current army (making sure to default to [] if it doesn’t exist – this is important!), add a new soldier to it (by appending a random name from our SOLDIER_NAMES variable), and then update the user’s information in our MongoDB database. Finally, we redirect back to the frontpage so that the user can see their new army.
It’s important to keep in mind that when you’re using a schema-less database like MongoDB, you may not actually have the properties you’re expecting to, especially if you haven’t set them. With that in mind, always be sure to write your code in such a way that it will still work if a an object doesn’t have the property that you were expecting it to.
If you visit your testing page at http://localhost:8000/ now and click the ‘Add Soldier’ button, you should notice that your army has increased – there’s a new name there!

Now that we can add soldiers to our army, we need to be able to remove them as well. Let’s write a quick view to do that:
@route('/remove-soldier/', method='POST') def remove_soldier(): current_user = get_current_user() army = current_user.get('army', []) if len(army) > 0: # make sure we don't pop from an empty list army.pop() users.update( {'ip': current_user['ip']}, {'$set': { 'army': army, }} ) redirect('/')
This view is just about the same as our add_soldier view from earlier, except that we’re removing soldiers instead of adding them before we write the user’s army into our database. We make sure they actually have soldiers in their ‘army’ array, and then we remove one if they do before writing their army back to the database, and redirecting back to the front page.

With that view written, there’s only one more to write – this one will live at ‘/rename-army/’, and update the names of all the soldiers in the user’s army:
@route('/rename-army/', method='POST') def rename_army(): current_user = get_current_user() army = current_user.get('army', []) army = [random.choice(SOLDIER_NAMES) for i in army] users.update( {'ip': current_user['ip']}, {'$set': { 'army': army, }} ) redirect('/')
As you can see, there isn’t much changed in this view either – we retrieve the user and their army, update the value of their ‘army’ array, write it to the database, and then redirect them. We use a list comprehension to update the name of every one of our army members, and that’s all that’s special here.
With that, we’re done! If you visit http://localhost:8000/, you should be able to add soldiers, remove soldiers, and rename soldiers – with all the data being stored in your MongoDB database.
If you’re stuck, or can’t seem to get it going, you can download the code for this tutorial at http://buildingbrowsergames.com/blog/wp-content/downloads/mongodb-python-1.zip.
Extra Homework
-
Our views involved writing a lot of boilerplate code, which can probably be refactored. Write a custom User object that handles storage and retrieval, along with making it easier to interact with the user’s army.
Modify the ‘army’ array to store custom Soldier objects, which have a name and an attack value – when a user adds a soldier to their army, randomize both values (some of the work for this has been done for you – see the download above).
Thursday Press Release: Fanta Trade
Hey, game creators – Building Browsergames is starting a new initiative called “Press Release Thursdays” – if you’ve got a new game that’s just getting out there, send us your press release and we’ll publish it!
To start things off, I have a release from Fanta-Trade, a stock market simulation game:

Fanta Trade is a browsergame where users are given 100,000 (fanta) euros to invest when they sign up – in stocks, commodities, currencies, warrants – almost everything you can imagine. One of the nice things about Fanta Trade is that stock names and prices are real – so you can become a successful stock trader (or lose it all) without taking any risks in real life. You can also find some elements typical to most browsergames within Fanta Trade: teams, rankings, and a forum in which the best players can be found providing their own take on the market.
Fanta-Trade is a good game for anyone who has an interest in learning how the world of finance works – or for anyone who wants to face a different kind of competition than “send your soldiers to the enemy’s village”.
Fanta-Trade’s sophisticated simulation engine works well, and has succeeded in transforming something as complicated as investing in the stock market into something easy and enjoyable for all – especially those who don’t know how the market works. And if you get stuck, the vibrant community is always providing tips for the game – all users can open their own financial blog and start writing their own market analyses, so you can even start dispensing your own advice if you so choose.
Fanta-Trade was created in Italy, so most of the players are Italian – but it has also been translated into English. You can check it out at http://fanta-trade.eu.
Do you have a press release that you’d like us to publish? Get in touch by e-mailing buildingbrowsergames@gmail.com, leaving a comment below, or following us on Twitter.
You should try a NoSQL database today.
One of the hottest new web technologies being discussed right now on the web is NoSQL Databases – with the two I hear about most being CouchDB and MongoDB.
NoSQL databases provide a different approach than traditional relational databases by being ’schema-less’ – allowing you to quickly and easily add arbitrary data to whatever you need to. This is a feature that’s extremely well-suited to browsergames – if you need a certain item to have a specific attribute that no other item has, it’s easy: you just add it, and move on. In a traditional SQL-based database setup, you’d need to add a column and make sure it was null or defaulted for all of your other items – which would be a major hassle if you had a large number of items.
Both the CouchDB and MongoDB sites have quickstart guides – if you haven’t tried one of the two out already, I highly encourage you to do so.
If you still need some convincing, here are a few areas in a game where a NoSQL database like Couch or Mongo will be better-suited than a traditional database like MySQL or PostgreSQL:
-
Items
So you have a potion, and potions usually heal people. But for this one super-rare potion, you want to heal the player and teleport them to a secret location. How?
In a traditional SQL-based system, you’d add a column to your items table to track what the potion did, and then add the extra code and handlers so that when a potion of the one super-rare type was used, the player was both healed and teleported. This works, but it’s a bit of a pain – you need to create/track a new item type, along with writing the code to handle it.
In a schema-less situation (when you’re using something like Couch or Mongo), all you have to do is add an attribute ‘teleports_player_to’ to your item – and then in your code, check if the item has a ‘teleports_player_to’ attribute. If it does, teleport the player there after running your item handling code. All done!
-
Quests
Quests are one area where schema-less storage really shines. You want to keep track of quests a player is on – but each quest is different! One quest involves killing a certain number of enemies, while another requires you to talk to two different NPC’s, while yet another needs you to move Important Package A to Secret Location B. How do you track all of that data?
In a relational database, you do it by keeping track of what ‘type’ each quest is, along with a small amount of arbitrary information related to that quest. For a “kill 10 ogres” quest, you need to track that it’s a killing quest, you need 10 things killed, and those ‘things’ are, in this case, ogres. For a “delivery” quest, you need to track which item the player has to have, and which location they need to take it to.
In situations like this, using a relational database to track information for your quests starts to break down very rapidly. What if you wanted to have a quest that required a player to kill 10 ogres, and then deliver a package to the town mayor? How would you do that?
With a schema-less database, this is easy. All you have to do is check which attributes you quest has, and write your code to work around them – so if you wanted to have a quest where users had to kill 28 goblins, talk to the goblin herder and the shepherd, and then deliver the goblin herder’s letter of surrender to the shepherd, you could – all you’d have to do is check the quest attributes.
What other situations can you come up with when a NoSQL database might be superior to using a relational database to track data in your game, or when a relational database is a better option? Let us know in the comments!
Adding a Reward System to your Game
I was recently contacted by Sunchaser from the BBGameZone forums about membership within the PBBG network for his topsite, top-pbbg.com. As you can see, his membership was accepted – and I also managed to get him to write a quick tutorial about how to integrate his site into your PBBG – so that you can drive traffic to your game by providing incentives for your players, using a reward system. Here’s the tutorial in full:
It’s possible to find on the internet a large number of sites that shows a list of browser-based games (these are normally called Topsites, or Toplists). A game owner can register their game into these sites – and by inserting a voting link in their game, their players can cast their vote for the game. With enough votes, your game can be pushed into the top positions on the topsite – increasing visibility, and driving more traffic to your game.
Some of these sites allow you, the game owner, to configure a reward system for your game, so that you can give your players an incentive to vote for your game.

Once you have configured the reward URL, an example of a voting link would be http://exampletoplist.com/in.php?u=789&key=12345667.
The parameter ‘u’ will contain the ID of the player that is voting, and the key is a random number. After the topsite has verified the vote, it will call back your configured link (for example, http://yourgame.com/reward.php?u=789&key=12345667&listname=top_pbbg). The reward script should check for a corresponding couple (userid + key), and then give the player the reward.
This tutorial will walk you through setting up a system that:
- Sends a player vote to a toplist, recording the vote
- Processes a callback from the toplist
Sending a player vote to a toplist
In order to trace the votes and prevent cheating, the votes sent to the toplist will need to be recorded within a database table. The first thing we’ll do is create a database table where we store different toplist sites, along with a table for recording user votes:
CREATE TABLE IF NOT EXISTS `cfg_ranking_sites` ( `id` int(11) NOT NULL AUTO_INCREMENT, --primary key `username` varchar(25) NOT NULL, --the username you registered with in the toplist `name` varchar(50) NOT NULL, --the toplist name `url` varchar(255) NOT NULL, --the toplist url (voting links of the toplist) `refererurl` varchar(255) NOT NULL, --the toplist root url PRIMARY KEY (`id`) ) ENGINE=MyISAM; CREATE TABLE IF NOT EXISTS `voting_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `list_id` int(11) NOT NULL, `vkey` varchar(25) NOT NULL, `status` varchar(25) NOT NULL, `ip` varchar(15) NOT NULL, `urlcalled` varchar(255) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM;
Next, we’ll add any topsites we wanted to track into our cf_ranking_sites table (in this case, top-pbbg.com):
INSERT INTO `cfg_ranking_sites` (`id`, `username`, `name`, `voting_link`, `refererurl`) VALUES (1, 'vlad', 'top_pbbg', 'http://www.top-pbbg.com/index.php?a=in&u=vlad&k=KEY', 'http://www.top-pbbg.com');
Next, we create a file called vote.php, which loads the topsite urls, generates a random key for users, tracks the vote, and sends the vote to the topsite. Here’s the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /**************************************************************************** File: vote.php Desc: traces a vote creating a random key, and sends the vote. ****************************************************************************/ $listname = mysql_real_escape_string( $_REQUEST['listname'] ); // load data of rating site $data = mysql_query( "select id, voting_link from cfg_ranking_sites where name = '{$listname}' " ); list( $list_id, $voting_link) = mysql_fetch_row( $data ); // generate a rnd string $k = substr( md5 ( time() . rand(1, 10000000) ), 1, 25); // get the user id from session // (substitute your method for finding the user id) $user = User::get_char_info(); $u = $user['user_id']; // place the generated random key and trace the vote $urlcalled = str_replace( "KEY", $k, $voting_link ); mysql_query( "insert into voting_log ( user_id, vkey, list_id, ip, status, urlcalled ) values ( '{$u}', '{$k}', $list_id, '".$_SERVER['REMOTE_ADDR']."', 'new', '{$urlcalled}' ) "); // send the vote header ( "location: $urlcalled" ); exit; |
Next, put your voting link inside a page that’s visible to your players, so that they can start clicking on it. Make sure the link points to your vote.php file:
<a href='vote.php?listname=top_pbbg'>Vote for us at Top PBBG!</a>
Now, your players should be able to vote, and you should be able to record their votes in the table voting_log.
Processing a callback from the toplist
Let’s assume you have configured your reward URL on top-pbbg.com to be the following reward URL:
<a href='http://yourgame.com/reward.php?listname=top_pbbg'>Vote for us at Top PBBG!</a>
To process the toplist callback and give rewards to your player(s), first create a file called reward.php and insert the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | // Set content type header('Content-type: text/xml'); // Check input, if keys are not present return error. // This check and the fields needs to be changed for each toplist if ( !isset($_GET['key']) or !isset($_GET['success']) or !isset($_GET['listname']) or ) { echo '<response rewarded="0" message="Invalid input." />'; die(); } // Get data $key = mysql_real_escape_string($_GET['key']); $success = mysql_real_escape_string($_GET['success']); $referer = $_SERVER['HTTP_REFERER']; $sql = "select v.id, v.user_id, r.name from voting_log v, cfg_ranking_sites r where vkey = '{$key}' and v.list_id = r.id and refererurl = '{$referer}' and status = 'new'"; $data = mysql_query( $sql ); if ( mysql_num_rows( $data ) == 0 ) { // insert your debug message, return error // mydebug( true, "match not found. ip: " . $_SERVER['REMOTE_ADDR'] . " key: " . $key . " referer: " . $referer); echo '<response rewarded="0" message="match not found." />'; exit; } list( $id, $user_id, $list_name ) = mysql_fetch_row( $data ); // give rewards to user, only if the vote was unique ($success==1) if ( $success == 1 ) { $r = rand( 1,2 ); if ( $r == 1 ) { ; //example: give reward and send information to user //mysql_query( "update user set char_adamantium = char_adamantium + 2 where user_id = " . $user_id ); //User::send_news( 'char', $user_id, "You got 2 adamantium for your vote at " . $list_name ); } else { ; //example: give reward and send information to user //mysql_query( "update user set char_mythril = char_mythril + 2 where user_id = " . $user_id ); //User::send_news( 'char', $user_id, "You got 2 mythril for your vote at " . $list_name ); } mysql_query( "update voting_log set status = 'rewardgiven' where id = " . $id ); echo '<response rewarded="1" message="Reward given." />'; } else { mysql_query( "update voting_log set status = 'rewardnotgiven' where id = " . $id ); echo '<response rewarded="0" message="Reward not given (not unique vote)." />'; } exit; |
Now, by changing the code within the if statements above, you should be able to give rewards to your players for voting for your game on different topsites.
Note
The script reward.php has been written to process rewards for one toplist – if you want it to process results from multiple toplists, you will want to have it handle the listname parameter, using that to decide which piece of code to run for which topsite.
And that’s all there is to setting up your game with a rewards URL! If you’re interested in doing this for your game, sign up at top-pbbg.com and get started – and then post a link to your game in the comments when you’re finished.
BBGameZone PBBG Contest 2010
It’s that time of year again – time for another PBBG Contest, hosted by the Browser-Based Game Zone! Here are the rules for the new contest:
- The contest runs for one month this time (instead of 2 last time) – it starts today, and ends on the 18th of february.
- Competitors are allowed to enter the contest in the middle, although they may start at a slight disadvantage.
- You must start with a new game – the only exceptions are old/ancient games that you haven’t worked on in a long time (subject to judge approval), or games that were entered in the last contest and placed lower than 5th when it came time for judging.
Right now, there are no prizes for the contest, as it’s solely for fun and reputation building – but that’s not to say that by the end of the month, there won’t be any.
Interested? Take a look at the forum thread for more information, and good luck!
Interview: Jodie from Shadowlack
I recently stumbled accross Shadowlack, which is (according to the website) “a Science Fantasy Play-By-Post RPG”. I thought that it might be interesting to hear some thoughts from someone running a game that isn’t based on the mafia or vampires. I managed to get in touch with Jodie Struthers, who’s been running Shadowlack for an amazing eight years! Here’s what she had to say:
What moviated you to start/build Shadowlack?
Shadowlack began as an ongoing comic book that several of my friends and I wrote while during grade school (circa 1997). We would pass this beaten up notebook around during class and add panels to it without any sort of pre-planning. The comic book grew to include over 2,600 individual illustrations. Eventually we had a really neat story going on. In 2002, I thought that it would be a great idea to open it up to people on the internet – but in text form.
Shadowlack is based on this same type of haphazard story telling with people writing from the perspectives of their original characters. Each post is unique and adds to the collaborative nature of the world.
After 7 years of running Shadowlack, have you ever been tempted to shut it down? What motivated you to keep going?
Oh yes. The last time I seriously thought about it was when my best friend at the time (who was helping run the site for a period), ended up leaving. At the time I really wasn’t sure what to do. She had been an integral piece to many of the plots that were on the go. I was very tempted to close down the site, however it was the support I got from the member base that kept it going. My other constant form of motivation is my desire to learn, and Shadowlack has been a great tool to learn from over the years.
Is the platform behind Shadowlack an out of the box solution, or a custom one?
Shadowlack right now is based upon a phpBB forum. I’ve built and re-built the site using many different platforms over the years and each time it’s gotten better (at least technically). At first I was limited by my skill-set in regards to what I could do, but now the only limitation I have right now is time.
Many play-by-post games suffer from “inflated” member counts because they require you to create separate accounts for each character that you wish to play. Shadowlack solves this problem with a modification that I wrote, that allows you to create multiple characters underneath one master account. Many other features and add-ons have been written to compliment this.
So no, it’s not just an out of the box forum solution with a skin or banner slapped thoughtlessly on it. There are also several automated processes that help me run the site, as well as a fully fledged content management system which I’ve also augmented. I like to think of it as a mutated version of phpBB… you know, with a few extra arms, eyes, and noodles kicking around.
How much time a day do you spend managing Shadowlack? Do you have to manage it at all, or do the players generally police themselves?
Daily my time spent on the site can range anywhere from five minutes to several hours, or sometimes no time at all. Due to the nature of the game (people who join generally think writing is fun and want to contribute to the project), we don’t get many trouble makers. I’ve only had to lay down the perma-ban hammer down on about 5 or so people over the years due to rule breaking.
Do you ever have to add new features to Shadowlack, or does the game run itself?
New features generally come in the form of new plots, creatures, and races. However, unlike the majority of the play-by-post games these days, it is not just a forum. It’s also an original world setting. Players are free to create and build their own alien races, religions, cities, monsters, diseases, and other such things. The game does run itself to an extent, but I find myself acting largely as a director whose job it is to fit creatures and story elements together in order to solve puzzles and make things semi-believable (it is a science fantasy game… so things don’t have to be 100% logical). We’ve had discussions about magic, apartment utilities, nomadic hunting, pubs, racism, reproduction, governments, and then some – all in relation to the Shadowlack world. The world of Shadowlack isn’t exactly an idealized society – it has its vices – but it certainly is an interesting one.
How ’sticky’ is Shadowlack? Lots of games only see players for a few minutes at a time(although frequently throughout the day) – are most visits on shadowlack short, or long?
A player’s stickiness depends entirely on their level of involvement on the site. Over the years I’ve also been able to track a few trends that generally coincide with school. Given that the demographic of the site is 17+ (with the majority of players in their early to mid twenties), times of slow activity are generally around university exam times, and during summer vacation.
The average time a person spends on the site (including visitors who pass us by), is 5 minutes. Generally registered members will spend half an hour or more on the site at a time. Writing takes some thought and dedication and this sort of niche market really isn’t for the type of person who wants instant satisfaction.
Have you had any trouble retaining players as the years went on?
People come and people go. There have been multiple cases where players have disappeared due to life happening only to return several months (or even years…) later. That said, there are also a handful of people who have been around since the conception of the site. Those that join and find that they like it, tend to stay and play. Which can be said for most games.
What’s the coolest thing that you’ve seen happen in Shadowlack?
All of our awesome plots and characters aside, the coolest thing has been watching the long-time players evolve and over time become skilled writers. One of my favourite things to do is look at people’s old roleplay posts from when they first joined and compare them to the ones that they’re writing today. The differences are phenomenal, and it makes me happy to hear that a person’s writing on the site has significantly contributed to their performance in educational institutions. I’m proud of my players for reasons that most game owners probably never consider.
A lot of players are drawn to flashier games that they can play on their own, and roleplaying(especially play-by-post) seems to have fallen by the wayside. What do you think draws people to Shadowlack, as opposed to just playing neopets or forumwarz?
One thing that I would like to stress is that play-by-post roleplaying is an extreme niche market. You really aren’t going to make money off of it unless it is just a small feature of the rest of your game. All of the big “successful” play-by-post games (of which there really isn’t any more than a handful that I’d actually consider to be successful), do not have true business models. They are run by hobbyists (like myself), non-profit organizations, or are kept alive by the donations of the players themselves.
I’m actually a long-time Neopets player myself and was largely responsible for getting the Role Playing board added to their site. With that being said, the draw to a place like Shadowlack is largely different. It is not a heavily policed site. Players are free to do a lot of things. It also isn’t rated G or “family safe,” so swearing is unlikely to get you in trouble. Over the years it has turned into a sort of “safe haven” and home for creative types. The site is full of aspiring artists, writers, and musicians. So the greatest draw to the site most likely is freedom of expression and creativity. I mean, yes we are writing stories together, but we’re also developing characters and building an original world setting. It’s fun, and not a complete waste of time since players are developing their writing skills.
What plans do you have for Shadowlack, going into the future?
Because Shadowlack is also a world building project, I’ve spent a lot of time looking into various CMS solutions, from Wiki scripts to full blown enterprise CMS solutions, in order to make building the world setting easier. After trying so many options and being unhappy with them (either because of spaghetti code, lack of structure, too much bloat, or what-have-you), I’ve started developing my own CMS framework that integrates with phpBB user sessions. Generally I plan to bring a lot of the world building aspect back. So more flora and fauna, as well as expanding on the science fiction element of the game in terms of space exploration and the planet’s technology.
Looking back into the past – what plans *did* you have for Shadowlack, and did you fulfill them?
My only clear plan from the beginning was really just to have fun and learn while doing it. It has been my pet project for years and everything that I’ve learned while working on it has helped further my career. So in that essence, I have fulfilled my plans (sort of… the learning process is perpetual).
One of my larger plans, that I pulled off last year, was the renaming of the site. Originally the game was called Ramath-lehi (the name of the planet). Unfortunately this was a name that was a) hard to remember for newcomers and b) hard to spell! I changed the name to Shadowlack gradually over 2009. Ramath-lehi is still the name of the central planet. Shadowlack is just the name of the bigger picture.
Do you do any marketing for Shadowlack, or just rely on word of mouth?
Right now it is entirely word of mouth. In the past I’ve done up posters and handed out business cards. It has also been a part of several advertising campaigns. Over the past four years though I have not put much emphasis on advertising and have purposely kept the player base small and manageable due to my lack of time (sudo get degree). However this may change in the future.
What has been the most challenging part of running Shadowlack for so long?
Life interrupting. Things have this wonderful way of just happening. Shadowlack was with me through my high school years and also with me while I was obtaining my degree. I’ve gone through a lot of changes and so has it.
What are you working on these days?
I run my own media and design consulting firm which takes up the majority of my free time. Aside from Shadowlack, I work on a small in-progress PBBG called Black Shuck that revolves around the afterlife and also lend a hand in regards to providing design work and coding for various other gaming sites.
If you could tell new browsergame developers one thing – what would it be?
Don’t give up so easily. It is true that many, many games die due to lack of interest and time. In the play-by-post niche, most games don’t even make it past the three month marker, which I’ve taken to referring to as RPG SIDS (Sudden Infant Death Syndrome). I believe that a lot of this has to do with the stagnant nature of most forum-based games. People set up a forum, create a fabulous plot, expect others to stay and play, and then get upset when their players have nothing of further interest holding them there. The game owner then loses interest, moves onto another project, and it dies. Rinse and repeat.
I’m not saying that every game idea is a clear winner and that constant persistence is key. I’m also not going to say that originality is a trump card. Simply take what you’ve learned, build upon it… and enjoy it. If you’ve got something good going on, other people will take notice of it (be warned that you may have to take to standing on street corners and flailing your arms – but oh, they will notice).
If you’d like to know more about Shadowlack, you can check it out at the Shadowlack website.
Christmas Survey Results
First off, a big thank you to everyone who filled out the survey – I’ve gotten confirmation on a lot of the plans that are being put into place, in addition to meeting a few more people who would be interested in writing for Building Browsergames (if you filled out the survey and gave me your e-mail, check it now – you should have an e-mail from me saying thanks).
The overwhelming response to the question What would you like to see on Building Browsergames primarily? was tutorials — while I know I’ve kept you all waiting, I’m hoping to be able to begin publishing some of the tutorials on the tutorial list very soon.
One of the readers who responded to the survey mentioned that they’d like to see some more “architecture” oriented tutorials – but forgot to provide their e-mail! If that was you, please get in touch with me at buildingbrowsergames@gmail.com, and I’ll see what I can do.
Based on the number of survey respondents who indicated that they were interested in writing for
Building Browsergames, it looks like we should have a lot more updates coming down the pipe – I also have a few changes in mind for the site that should make it easier for new (and old) visitors to find things on the site that they haven’t already, going into the new year. There are big plans for The PBBG Network and PBBG Snippets in the works as well — but I’m keeping those under wraps for now.
Once again, thanks to everyone who responded – I hope that everyone had a safe and happy new year.
How are we doing?
Now that Building Browsergames has started back up(albeit slowly), there are a lot of big changes planned. With that in mind, I wanted to ask you, the community, for some opinions on what direction you think the site should take(and how it’s doing so far).
If you’d like to provide some feedback, please take some time to fill out the Building Browsergames Christmas Survey, and give me your opinions.
Want to leave more feedback? Get in touch with a comment, or send an e-mail to buildingbrowsergames@gmail.com.
EffectGames.com launches
I recently stumbled accross EffectGames.com, which bills itself as providing “free, online tools for building, sharing and playing your own browser based games”. I managed to get in touch with Joseph Huckaby, one of it’s cofounders, for a little more about the service:
Well, it took me four years, but I believe I have finally proven that you don’t need Flash to make great web games. I have just launched a new website called “Effect Games”, which allows developers to create professional quality JavaScript games for free, and publish and share the games just like they would a YouTube video.
There are several game demos up on the site, so you can see what the engine can do. All modern browsers and platforms are supported, including IE 6+, Firefox 3+, Safari 3+, Chrome 1+, and Opera 9+.
Games are powered by the “Effect Engine”, my JavaScript / DHTML library that provides the framework for displaying and animating all the graphics, playing all the sounds & music, handling the keyboard & mouse, and sprite collision detection. It can smoothly render multiple layers of parallax scrolling tiles and sprites using pure DHTML (no Canvas or SVG, so it plays nice with all browsers).HTML 5 Audio is used where supported (currently Safari on Mac OS X 10.5 only, 10.6 and Firefox coming soon), and 3rd party extensions used elsewhere. But developers don’t have to worry about the underlying implementation. The engine provides a single API, which is the same no matter what tech is used under the covers. Write your game code once, and it’ll run everywhere. Everything is documented online, including a side-scrolling platformer tutorial.
We have an integrated web app which allows developers to prepare and design their game online. It comes with an Asset Manager for uploading and organizing game graphics and audio, a Level Editor for laying out sprites and tiles into levels, and lots of tools for manipulating graphics in real-time using non-destructive filters (scaling, rotation, and a number of other transforms).
Users can develop their games locally on their Macs or PCs, and don’t have to upload any code until they are ready to publish. The game publisher can compile their code automatically using Google Closure, and provides them with a unique URL and embed code to share the game on their own site, blog, or anywhere they want.
The engine also has a Plugin architecture to bring in 3rd party libraries to add new features. For example, we just released a Box2D Physics Plugin, bringing realistic physics simulations into the engine.
We’re getting ready to launch a slew of new features in the coming months, including video support, achievements, leaderboards, more social network integration, and the ability to save & load games in progress.
After taking a look at some of the demos, it looks like there are a lot of cool things to be made with EffectGames – it will be interesting to see what the community creates with the service.
Got Snippets?
Frequently while working on a browsergame/PBBG, I’ll write a piece of code and then think to myself “hey, that might be useful in another project some day”. In those situations, I’ll put the snippet somewhere on my system, and then go about my day.
However, there are a few problems with that approach. For one thing, it’s impossible for me to show someone else my snippet collection – and sharing your snippets once you hit the 10+ mark quickly becomes less than enjoyable. Also, what happens if your system goes down?
With that said, I am pleased to announce the launch of http://pbbgsnippets.com, a new snippet-sharing site geared specifically towards PBBG developers. I collaborated with Janne Siera on the concept, and Gabriel Bianconi did the design. Janne and I are hoping that this new snippets site will be able to spur a little bit more sharing within the PBBG community; I’m sure there are tons of useful snippets out there to share.
The code behind http://pbbgsnippets.com is available, and languages can be added as necessary – if anyone would like a copy of the source code(or a language added), send an e-mail to buildingbrowsergames@gmail.com, or just post a comment.




