<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Building Browsergames &#187; diaryofabrowsergame</title>
	<atom:link href="http://buildingbrowsergames.com/category/diaryofabrowsergame/feed/" rel="self" type="application/rss+xml" />
	<link>http://buildingbrowsergames.com</link>
	<description>Ever wanted to build a browsergame?</description>
	<lastBuildDate>Mon, 29 Mar 2010 14:00:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Post-Mortem: Rawrmy</title>
		<link>http://buildingbrowsergames.com/2008/12/11/post-mortem-rawrmy/</link>
		<comments>http://buildingbrowsergames.com/2008/12/11/post-mortem-rawrmy/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 14:00:38 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[post-mortem]]></category>
		<category><![CDATA[rawrmy]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=610</guid>
		<description><![CDATA[Browser-Based Game Zone&#8217;s PBBG Contest comes to a close today, and the month of judging will begin &#8211; unfortunately, without Rawrmy. Due to unforeseen circumstances, I was unable to complete Rawrmy in the time allotted &#8211; but that doesn&#8217;t mean that I didn&#8217;t give it a fair shot.
What Went Right
A few decisions that I made [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.bbgamezone.com/contest.php'>Browser-Based Game Zone&#8217;s PBBG Contest</a> comes to a close today, and the month of judging will begin &#8211; unfortunately, without Rawrmy. Due to unforeseen circumstances, I was unable to complete Rawrmy in the time allotted &#8211; but that doesn&#8217;t mean that I didn&#8217;t give it a fair shot.</p>
<h2>What Went Right</h2>
<p>A few decisions that I made early on helped to get Rawrmy &#8220;on it&#8217;s feet&#8221;, for all that there were some setbacks during development. One of those decisions was to use <a href='http://djangoproject.com'>Django</a>, a popular Python web framework, to develop all of Rawrmy&#8217;s functionality. Django is geared towards rapid development in the same way that Rails is; both frameworks lend themselves very well to getting something out the door as quickly as possible &#8211; which was one of the goals for this contest due to the compressed time frame. Straight out of the box, Django gives you a pre-wired authentication system and admin backend &#8211; both of which were immensely valuable during initial development.</p>
<p>Another decision that helped ease the development process was a bit of a harder one to enforce: <strong>every feature implemented was droppable</strong>. What that means is, for any feature I was developing, I&#8217;d set a timer. If it took me longer than an hour or two, the feature got dropped &#8211; although I marked it as &#8220;come back to later&#8221;. Doing this allowed me to trim the fat out of Rawrmy, and focus only on the pieces that would get it to being a finished game the fastest.</p>
<h2>What Went Wrong</h2>
<p>Time was a massive factor that prevented me from completing Rawrmy. In hindsight, I probably should have taken some time off from my day job, or diverted time from some of my other projects &#8211; Rawrmy is unfinished because I was unable to devote as much time as I would have liked to to developing it.</p>
<p>Some things took too long. While I mentioned earlier that every feature was droppable, it was only <strong>after</strong> I had sunk a few precious hours into a specific(and still broken) feature that I realized I would need to enact this rule. If I had realized how much time I was sinking into non-valuable features at the time as opposed to afterwards, I probably would have had a lot more time to spend on getting the game working(and less time spent chasing down random bugs).</p>
<p>Lack of direction was a problem with Rawrmy. I have to admit that when I first decided I should enter the contest, I didn&#8217;t have any idea what I would build a game based on &#8211; and I believe this was one of my biggest problems. <a href='http://www.johnmunsch.com'>John Munsch</a> had clearly been planning out his idea for &#8216;Big Villain&#8217; for quite some time, and was therefore only waiting to do the development on his game. Multiple other entrants were also in the same position; the fact that they had already planned out most of their game gave them a massive advantage, because they could get started developing while I was still attempting to come up with a concept for Rawrmy.</p>
<p>When I initially entered the contest, I also had a team member who would be creating all of the written content for the game. However, after a week or so, my partner disappeared &#8211; and I still have yet to hear from him. This was another setback; the initial idea for Rawrmy was heavily text-based, and while I&#8217;m sure that I could have written the content myself, it would have distracted me from getting the game running and polished.</p>
<h2>What I Learned</h2>
<p>When you&#8217;re entering a contest with a short timeframe, you need to have a firm idea of what you&#8217;re going to build &#8211; it doesn&#8217;t neccessarily have to be large, but you need to have that idea and stick to it. Changing gears in the middle of a project will kill it &#8211; Rawrmy lost a good week or so&#8217;s worth of development time when my partner disappeared.</p>
<p>When you enter a contest like this, you need to be prepared to make the commitment. You need to be willing to commit development, monetary, and any other resources neccessary to get your game done &#8211; and while I was able to half-commit on most of those things, it&#8217;s not enough. The next time I enter a browsergame contest, I&#8217;ll make sure that I&#8217;ve got my other projects cleared out of the way for the duration, and can therefore focus <strong>only</strong> on the contest &#8211; instead of getting distracted by other things.</p>
<p>All told, I had a positive experience entering the contest &#8211; even if I had to drop out at the end. I learned a lot about my own development practices, and what I can do to improve in the future &#8211; which is enough of a win for me.</p>
<p>If you&#8217;re interested in seeing what Rawrmy was like, you can check it out at <a href='http://rawrmy.com'>rawrmy.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/12/11/post-mortem-rawrmy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rawrmy Drops Out</title>
		<link>http://buildingbrowsergames.com/2008/12/08/rawrmy-drops-out/</link>
		<comments>http://buildingbrowsergames.com/2008/12/08/rawrmy-drops-out/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:00:25 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[rawrmy]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=607</guid>
		<description><![CDATA[Browser-Based Game Zone&#8217;s PBBG Contest will be coming to a close this week, on December 11th. While Rawrmy was entered in the contest, I am afraid that Rawrmy will have to drop out of the running.
While the time allotted for the contest was more than adequate, too many distractions came up that prevented me from [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://bbgamezone.com/'>Browser-Based Game Zone</a>&#8217;s <a href='http://bbgamezone.com/contest.php'>PBBG Contest</a> will be coming to a close this week, on December 11th. While Rawrmy was entered in the contest, I am afraid that Rawrmy will have to drop out of the running.</p>
<p>While the time allotted for the contest was more than adequate, too many distractions came up that prevented me from spending enough time on Rawrmy to make it a serious contender for the contest at all. While I am still hoping to polish and deploy Rawrmy for the 11th, it will no longer be as a serious contender in the contest; merely as a prototype.</p>
<p>In addition to deploying Rawrmy on thursday, I will also be posting a post-mortem of the development process &#8211; detailing what worked, what didn&#8217;t, and what I would have changed.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/12/08/rawrmy-drops-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fleshing out Rawrmy</title>
		<link>http://buildingbrowsergames.com/2008/12/01/fleshing-out-rawrmy/</link>
		<comments>http://buildingbrowsergames.com/2008/12/01/fleshing-out-rawrmy/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 14:00:10 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[rawrmy]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=598</guid>
		<description><![CDATA[This week was spent trying to flesh out more of Rawrmy. While most of the systems in the game are built and in place, the game is currently extremely short &#8211; in order for it to be a serious contender at all, it will need to have a lot more content.
With that in mind, I [...]]]></description>
			<content:encoded><![CDATA[<p>This week was spent trying to flesh out more of Rawrmy. While most of the systems in the game are built and in place, the game is currently <strong>extremely</strong> short &#8211; in order for it to be a serious contender at all, it will need to have a lot more content.</p>
<p>With that in mind, I have been working to build something like a quests system into Rawrmy &#8211; essentially, there is a large over-arching storyline with the player is part of(sort of like <a href='http://kingdomofloathing.com'>Kingdom of Loathing</a>, although nowhere near as developered). Unfortunately, it turns out that designing a flexible quests system is a lot of work &#8211; and as a result, while there are quests in place, I have had to build them in a much more rigid form than I would have liked to. Essentially, I have created an enum of the different steps in the story, and I am storing which step of the story the player is on in my User Profile model:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> STORY:
	STARTING,FRIDGE,TOASTER,OVEN,BATHROOM = <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">	story_step       = models.<span style="color: black;">IntegerField</span><span style="color: black;">&#40;</span>max_length=<span style="color: #ff4500;">25</span>,default=STORY.<span style="color: black;">STARTING</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Checking which step of the story the player is on is then done by our view:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">profile</span>.<span style="color: black;">story_step</span> == STORY.<span style="color: black;">STARTING</span>:
	<span style="color: #dc143c;">profile</span>.<span style="color: black;">story_step</span> += <span style="color: #ff4500;">1</span>
	<span style="color: #dc143c;">profile</span>.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> area_template<span style="color: black;">&#40;</span>request,<span style="color: #483d8b;">'couch'</span>,<span style="color: #483d8b;">'starting.html'</span><span style="color: black;">&#41;</span></pre></div></div>

<p>While this works, it&#8217;s not quite what I like &#8211; but the deadline for the contest is looming, and I will not have time to rewrite how the quests system works.</p>
<p>At any rate, progress is slowly being made &#8211; while I have had to strip out a lot of the features I would have liked to have, I should at least have the beginnings of the game playable by the deadline.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/12/01/fleshing-out-rawrmy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rawrmy&#8217;s Crafting System</title>
		<link>http://buildingbrowsergames.com/2008/11/10/rawrmys-crafting-system/</link>
		<comments>http://buildingbrowsergames.com/2008/11/10/rawrmys-crafting-system/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 14:00:12 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[crafting]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[frustrations]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=557</guid>
		<description><![CDATA[This week was spent working on Rawrmy&#8217;s escort and crafting system.
One of the things that I struggled with this week was the limitations of Django&#8217;s queryset API &#8211; while it&#8217;s both powerful and flexible, there are a few things that it cannot do. This problem reared it&#8217;s head when I was working on the crafting [...]]]></description>
			<content:encoded><![CDATA[<p>This week was spent working on Rawrmy&#8217;s escort and crafting system.</p>
<p>One of the things that I struggled with this week was the limitations of Django&#8217;s queryset API &#8211; while it&#8217;s both powerful <strong>and</strong> flexible, there are a few things that it cannot do. This problem reared it&#8217;s head when I was working on the crafting system.</p>
<p>When a player goes to craft an item, they are presented with a multi-select that will display all of the craftable items in their inventory. They then select which items they would like to craft with, and we retrieve anything that they can make out of them.</p>
<p>The problem, here, is that &#8216;ingredients&#8217; on our craftables is a ManyToManyField &#8211; and I wanted to retrieve an exact match. For example, if a player had tried to craft with &#8216;flour&#8217; and &#8216;yeast&#8217;, any craftable with &#8216;flour&#8217; or &#8216;yeast&#8217; <strong>and not &#8217;sugar&#8217;</strong> would be returned. Retrieving the &#8216;flour&#8217; and &#8216;yeast&#8217; craftables was easy, using an __in query:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">	craftables = Craftables.<span style="color: black;">objects</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>ingredients__in=form.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'ingredients])</span></pre></div></div>

<p>However, making sure that the &#8217;sugar&#8217; craftables were not retrieved was slightly more difficult(and took me a while to figure out). Essentially, the process involves first creating a list of ingredients that are <strong>not</strong> in the group of selected ingredients, and then excluding any craftable with ingredients in that list(after we filtered). The new code looked something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">	bad_ids = <span style="color: black;">&#91;</span>ingredient.<span style="color: #008000;">id</span> <span style="color: #ff7700;font-weight:bold;">for</span> ingredient <span style="color: #ff7700;font-weight:bold;">in</span> form.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'ingredients'</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>
	craftable = Craftable.<span style="color: black;">objects</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>ingredients__in=form.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'ingredients'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>.<span style="color: black;">exclude</span><span style="color: black;">&#40;</span>ingredients__in=Item.<span style="color: black;">objects</span>.<span style="color: black;">exclude</span><span style="color: black;">&#40;</span>id__in=bad_ids<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Unfortunately, that only seemed to work in <strong>some</strong> cases &#8211; and as a result, I&#8217;ve been debugging and rebugging the same piece of code for most of the week.</p>
<p>This slowdown is unfortunate &#8211; but I think that, moving forward, the crafting system is going to get replaced with a simpler two dropdown system and learnable recipes.</p>
<h2>Completed this week:</h2>
<ul>
<li>Laid the groundwork for crafting and the escort system.</li>
</ul>
<h2>Still to do:</h2>
<ul>
<li>Fix the bugs in crafting item retrieval &#8211; they&#8217;re a gamebreaker right now.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/11/10/rawrmys-crafting-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rawrmy&#8217;s Inventory</title>
		<link>http://buildingbrowsergames.com/2008/11/03/rawrmys-inventory/</link>
		<comments>http://buildingbrowsergames.com/2008/11/03/rawrmys-inventory/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 14:00:29 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[rawrmy]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=538</guid>
		<description><![CDATA[This week, I focused on developing Rawrmy&#8217;s inventory system.
The typical inventory system is fairly simple: you have the player who owns the item, the item itself, and (perhaps) the quantity of the item.
One of the nicer features of Django that building the inventory system has introduced me to is reverse relations; they make it very [...]]]></description>
			<content:encoded><![CDATA[<p>This week, I focused on developing Rawrmy&#8217;s inventory system.</p>
<p>The typical inventory system is fairly simple: you have the player who owns the item, the item itself, and (perhaps) the quantity of the item.</p>
<p>One of the nicer features of Django that building the inventory system has introduced me to is reverse relations; they make it very easy for me to add new items to the user&#8217;s inventory. I am storing their inventory in my UserProfile model, and using a ManyToManyField for keeping track of the user&#8217;s items(with an intermediary &#8216;through&#8217; model for keeping track of the quantity of the item), and that means that I can add items to the player&#8217;s inventory with a single line of code:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #dc143c;">profile</span>.<span style="color: black;">inventoryitem_set</span>.<span style="color: black;">create</span><span style="color: black;">&#40;</span>item=item,owner=<span style="color: #dc143c;">profile</span><span style="color: black;">&#41;</span></pre></div></div>

<p>With <em>item</em> being the item I want to add, and <em>owner</em> being the profile I am adding the item for.</p>
<p>One question that came up while building my inventory system was <strong>&#8220;Should items be stackable?&#8221;</strong> &#8211; because it makes sense for things like weapons not to stack, but things like usables <strong>to</strong> stack. In the end, I decided to add a <em>stackable</em> BooleanField to all of my items, and then just check it in my InventoryItem&#8217;s save() method, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> save<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,<span style="color: #66cc66;">*</span>args,<span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">item</span>.<span style="color: black;">stackable</span> <span style="color: #ff7700;font-weight:bold;">and</span> kwargs.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'force_insert'</span>,<span style="color: #008000;">False</span><span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span> = InventoryItem.<span style="color: black;">objects</span>.<span style="color: black;">get_or_create</span><span style="color: black;">&#40;</span>item=<span style="color: #008000;">self</span>.<span style="color: black;">item</span>,owner=<span style="color: #008000;">self</span>.<span style="color: black;">owner</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
		<span style="color: #008000;">self</span>.<span style="color: black;">quantity</span> += <span style="color: #ff4500;">1</span>
		kwargs<span style="color: black;">&#91;</span><span style="color: #483d8b;">'force_insert'</span><span style="color: black;">&#93;</span> = <span style="color: #008000;">False</span>
	<span style="color: #008000;">super</span><span style="color: black;">&#40;</span>InventoryItem, <span style="color: #008000;">self</span><span style="color: black;">&#41;</span>.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args,<span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span></pre></div></div>

<p>Is this the best way to do it? Probably not. But it lets me have items that do stack and items that don&#8217;t stack fairly easily, in addition to being able to add items to the player&#8217;s inventory without having to write a lot of boilerplate code.</p>
<p>Overall, progress is being made &#8211; while I&#8217;m not sure I will be able to finish as much as I would have liked to by the time that the contest is over (December 11th), I&#8217;m fairly confident that I will have a codebase completed that I am happy to work on far into the future.</p>
<h2>Completed this week:</h2>
<ul>
<li>Basic combat system &#8211; needs some tweaking but currently workable</li>
<li>Inventory management &#8211; add items, remove items</li>
</ul>
<h2>Still to do:</h2>
<ul>
<li>Create more content and quests &#8211; while there are plans in place for upwards of 5 areas at the start of the game, there have only been quests for 2 of them designed so far.</li>
<li>Write better storyline content &#8211; right now it just says things like &#8220;the storyteller tells you to go over there. So you decide to do that.&#8221;</li>
<li>Lots of polishing and re-working &#8211; while most of the internals of the game work and are playable right now, they don&#8217;t feel &#8220;just right&#8221; yet.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/11/03/rawrmys-inventory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rawrmy Starts</title>
		<link>http://buildingbrowsergames.com/2008/10/27/rawrmy-starts/</link>
		<comments>http://buildingbrowsergames.com/2008/10/27/rawrmy-starts/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 14:00:32 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[rawrmy]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=527</guid>
		<description><![CDATA[This week was spent getting started on Rawrmy &#8211; building the initial systems, and planning out how the game will play out.
I have decided to build Rawrmy with Django &#8211; which is an MVC framework like Ruby on Rails(except in Python instead of Ruby).
Django has a vast number of freely available libraries for common functions, [...]]]></description>
			<content:encoded><![CDATA[<p>This week was spent getting started on Rawrmy &#8211; building the initial systems, and planning out how the game will play out.</p>
<p>I have decided to build Rawrmy with <a href='http://djangoproject.com'>Django</a> &#8211; which is an MVC framework like Ruby on Rails(except in Python instead of Ruby).</p>
<p>Django has a vast number of freely available libraries for common functions, in addition to coming with some handy features bundled &#8211; like an auto-generating admin interface, and authentication systems that are pre-built for you(and will work for 90% of the things you&#8217;d need it for).</p>
<p>With that said, all of Rawrmy&#8217;s initial systems are built &#8211; login, registration, and profiles &#8211; mostly by taking advantage of the excellent <a href='http://code.google.com/p/django-registration/'>django-registration</a> library.</p>
<p>One of the stumbling blocks that I&#8217;ve encountered while working on Rawrmy is flexibility &#8211; while I&#8217;d like to make my systems as flexible as possible for the sake of future content, I am rapidly finding that there is a certain point where you need to trade flexibility for <strong>just writing the code</strong>. This is becoming most evident with the area exploration system &#8211; areas are currently a model in my database, and their code looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> Area<span style="color: black;">&#40;</span>models.<span style="color: black;">Model</span><span style="color: black;">&#41;</span>:
	title = models.<span style="color: black;">CharField</span><span style="color: black;">&#40;</span>max_length=<span style="color: #ff4500;">500</span><span style="color: black;">&#41;</span>
	slug = models.<span style="color: black;">SlugField</span><span style="color: black;">&#40;</span>blank=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
	monsters = models.<span style="color: black;">ManyToManyField</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Monster'</span>,null=<span style="color: #008000;">True</span>,blank=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> save<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,<span style="color: #66cc66;">*</span>args,<span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">self</span>.<span style="color: black;">slug</span>:
			<span style="color: #008000;">self</span>.<span style="color: black;">slug</span> = slugify<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">title</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">super</span><span style="color: black;">&#40;</span>Area,<span style="color: #008000;">self</span><span style="color: black;">&#41;</span>.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args,<span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__unicode__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">title</span></pre></div></div>

<p>Originally, my URLS looked like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'explore/(?P&lt;area_slug&gt;.+)/$'</span>,views.<span style="color: black;">explore</span>,name=<span style="color: #483d8b;">'explore-area'</span><span style="color: black;">&#41;</span>,</pre></div></div>

<p>I had planned to retrieve the area the user was exploring based on the slug, and then use that to figure out what happened when they explored that area. However, I quickly came up against issues with the flexibility of this approach &#8211; while it makes it easy to add more areas and allow users to explore them, it makes it <strong>very</strong> difficult for me as the developer to add custom behavior to an area. If I want to add custom logic to the Forest area but not the Mountain area, how am I supposed to do that using the current configuration?</p>
<p>With that in mind, my urlpatterns have changed, and I now hard-code the area slug, and map it to a specific view:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'explore/forest/$'</span>,views.<span style="color: black;">explore_forest</span>,name=<span style="color: #483d8b;">'explore-forest'</span><span style="color: black;">&#41;</span>,</pre></div></div>

<p>This way is a little less flexible in terms of being able to deploy new areas instantly, <strong>but</strong> it allows me to write any custom logic I need &#8211; which is what I was looking for.</p>
<h2>Completed this week:</h2>
<ul>
<li>User management &#8211; login, logout, register</li>
<li>Escort management &#8211; choose escort</li>
<li>Class Choice &#8211; choose class</li>
</ul>
<h2>Still to do:</h2>
<ul>
<li>Exploring &#8211; needs a lot of fleshing out</li>
<li>Storyline &#8211; needs to be better (writer disappeared)</li>
<li>Hook &#8211; what makes this game fun?</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/10/27/rawrmy-starts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diary of a Browsergame: Re-booting</title>
		<link>http://buildingbrowsergames.com/2008/10/20/diary-of-a-browsergame-re-booting/</link>
		<comments>http://buildingbrowsergames.com/2008/10/20/diary-of-a-browsergame-re-booting/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 14:00:13 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[doab]]></category>
		<category><![CDATA[restart]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=494</guid>
		<description><![CDATA[As you all know by now, Browser-Based Game Zone is running a PBBG contest.
As you&#8217;ve probably guessed by now, work on Working Title has sort of fallen by the wayside. Life got busy, and I couldn&#8217;t devote as much time to the project as I would have liked to for a while. Having said that, [...]]]></description>
			<content:encoded><![CDATA[<p>As you all know by now, <a href='http://www.bbgamezone.com/contest.php'>Browser-Based Game Zone</a> is running a PBBG contest.</p>
<p>As you&#8217;ve probably guessed by now, work on Working Title has sort of fallen by the wayside. Life got busy, and I couldn&#8217;t devote as much time to the project as I would have liked to for a while. Having said that, Working Title has been shelved for now &#8211; when I&#8217;m a little less busy, I will probably come back to it &#8211; but for now, it is shelved.</p>
<p>One thing not all of you know, however, is that I will be entering the PBBG contest as well. The game that I will be working on has been tentatively called &#8216;Rawrmy&#8217;(although we&#8217;re working on a better name). It will be a mostly-singleplayer RPG, with a heavy focus on a quest-based storyline.</p>
<p>There isn&#8217;t really much more to say about it right now &#8211; but check back every monday for posts on Rawrmy&#8217;s progress!</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/10/20/diary-of-a-browsergame-re-booting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diary a Browsergame: building prototypes</title>
		<link>http://buildingbrowsergames.com/2008/08/01/diary-a-browsergame-building-prototypes/</link>
		<comments>http://buildingbrowsergames.com/2008/08/01/diary-a-browsergame-building-prototypes/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 14:00:38 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=130</guid>
		<description><![CDATA[As discussed in Working Title&#8217;s design document, we are going to be using Ajax to dynamically update the screen. Ideally, it will look as if a user has entered an IRC chat-room &#8211; except instead of chatting, they&#8217;ll be playing a game.
I always like to prototype my projects before I start them &#8211; I start [...]]]></description>
			<content:encoded><![CDATA[<p>As discussed in <a href='http://buildingbrowsergames.com/workingtitle/design/1.0.html'>Working Title&#8217;s design document</a>, we are going to be using Ajax to dynamically update the screen. Ideally, it will look as if a user has entered an IRC chat-room &#8211; except instead of chatting, they&#8217;ll be playing a game.</p>
<p>I always like to prototype my projects before I start them &#8211; I start with the template, and then start building quick mockups of functionality I plan to have. Usually, the code that I used to build my prototype can be cleaned up and used to build whatever I&#8217;m building anyways, so I&#8217;m still writing code towards my goal &#8211; with the benefit of having something to show for it a little faster.</p>
<p>With that in mind, I set out to build a simple tester page that shows off some of the Javascript that will be behind Working Title&#8217;s &#8216;play&#8217; page &#8211; while it doesn&#8217;t do any posting back, it demonstrates what the functionality is supposed to look and feel like(albeit a little faster than it would be in the actual game). Here&#8217;s the <a href='http://buildingbrowsergames.com/workingtitle/design/test.html'>Working Title test page</a>, which will let you see how I&#8217;m planning on having the game behave.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/08/01/diary-a-browsergame-building-prototypes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diary of a Browsergame: Planning out the templates</title>
		<link>http://buildingbrowsergames.com/2008/07/23/diary-of-a-browsergame-planning-out-the-templates/</link>
		<comments>http://buildingbrowsergames.com/2008/07/23/diary-of-a-browsergame-planning-out-the-templates/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 14:00:13 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[workingtitle]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=99</guid>
		<description><![CDATA[Now that I&#8217;ve set up my database, it&#8217;s time to settle on a templating system, and decide on how I want my templates to work.
Working Title only has a few pages that will need to be displayed &#8211; according to Design 1.0, there are a total of 7 &#8211; Home, Design Document, Register, Login, Logout, [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;ve <a href='http://buildingbrowsergames.com/2008/07/14/diary-of-a-browsergame-setting-up-the-database/'>set up my database</a>, it&#8217;s time to settle on a templating system, and decide on how I want my templates to work.</p>
<p>Working Title only has a few pages that will need to be displayed &#8211; according to <a href='http://buildingbrowsergames.com/workingtitle/design/1.0.html'>Design 1.0</a>, there are a total of 7 &#8211; Home, Design Document, Register, Login, Logout, Codex, and Play. This will make developing the templates very easy, as there are only a few that I need to build.</p>
<p>I&#8217;m going to use <a href='http://search.cpan.org/dist/HTML-Template/Template.pm'>HTML::Template</a> for my templating system, just like we have been in our <a href='http://buildingbrowsergames.com/category/buildingbrowsergames/perl/'>Perl-based browsergame tutorial</a>. However, my templating setup will be slightly different; I am planning on nesting two templates within each other. I&#8217;ll have a simple outer template which defines some of the global styles for all of the pages, and then another inner template that is populated with the information unique to the page(this is an example of applying DRY to my templates).</p>
<p>To that end, I&#8217;ve whipped up a quick outer template for Working Title, that will(for the moment) do what I need it to. There isn&#8217;t much to it, but you can take a look at it <a href='http://buildingbrowsergames.com/workingtitle/design/template-outer.html'>here</a>.</p>
<p>Is it a rough template? Yes. Will it change before Working title is done? Probably. But it&#8217;s enough to get me up and running, and free up my time to work on developing the rest of the game, instead of just working on the template.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/07/23/diary-of-a-browsergame-planning-out-the-templates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Diary of a Browsergame: Setting up the database</title>
		<link>http://buildingbrowsergames.com/2008/07/14/diary-of-a-browsergame-setting-up-the-database/</link>
		<comments>http://buildingbrowsergames.com/2008/07/14/diary-of-a-browsergame-setting-up-the-database/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:00:02 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[diaryofabrowsergame]]></category>
		<category><![CDATA[workingtitle]]></category>

		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=83</guid>
		<description><![CDATA[One of the first things I do for any new project of mine is design the database &#8211; so that&#8217;s what&#8217;s going to happen to Working Title today. This design will probably change slowly over the course of development &#8211; it&#8217;s just a good starting point for now.
To begin with, we&#8217;ll need a users table.

CREATE [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things I do for any new project of mine is design the database &#8211; so that&#8217;s what&#8217;s going to happen to Working Title today. This design will probably change slowly over the course of development &#8211; it&#8217;s just a good starting point for now.</p>
<p>To begin with, we&#8217;ll need a users table.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> users <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	username text<span style="color: #66cc66;">,</span>
	password text<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>And once we have that, a <em>stats</em> table:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> stats <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	display_name text<span style="color: #66cc66;">,</span>
	short_name varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>If this all looks familiar so far, that&#8217;s because it should &#8211; this is the exact same table structure(currently, anyway) as the game we&#8217;ve been working on. I&#8217;m taking all of the design decisions and changes that we made in our other project, and doing my best to apply them here &#8211; thereby continually improving my code, and my design.</p>
<p>Because Working Title will have a few distinct &#8216;entities&#8217;, my <em>entity_stats</em> is going to look a little bit different than the one we&#8217;re using right now. According to <a href='http://buildingbrowsergames.com/workingtitle/design/1.0.html'>the design document</a>, there are 4 main entities &#8211; players, rooms, monsters, and items. Those will make the enum in the <em>entity_stats</em> table:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> entity_stats <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	stat_id int<span style="color: #66cc66;">,</span>
	entity_id int<span style="color: #66cc66;">,</span>
	value text<span style="color: #66cc66;">,</span>
	entity_type ENUM<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Monster'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Item'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Room'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Thinking about it a little more, I&#8217;m pretty sure that I don&#8217;t <strong>need</strong> separate tables for each of the entities that can exist within Working Title &#8211; all I need is a single table to keep track of their name, ID, description, and type. So that&#8217;s what I&#8217;m going to do:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> entities <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	name text<span style="color: #66cc66;">,</span>
	entity_type ENUM<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Monster'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Item'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Room'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	description text<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>One of the things that the design document mentions is that &#8220;users will move between rooms&#8221; &#8211; which means that I will need way to track which room a user is currently in. I&#8217;m going to use a stat to do this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Room'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_room'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>There are also supposed to be players, monsters, <strong>and</strong> items inside rooms &#8211; so I&#8217;ll need a table to keep track of all the entities within a room:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> room_entities <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	room int<span style="color: #66cc66;">,</span>
	entity_id int<span style="color: #66cc66;">,</span>
	entity_type ENUM<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Monster'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'Item'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>	
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Monsters will be able to drop items, so I&#8217;m going to need to add a table to do that. Because all they&#8217;re going to be able to drop is items(not other monsters or rooms or anything), I can make it so that the <em>monster_drops</em> table only contains information on what items, and what the percentage chance is for them to drop:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> monster_drops <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	monster int<span style="color: #66cc66;">,</span>
	item int<span style="color: #66cc66;">,</span>
	drop_rate int<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The next table I need to add is one to track a user&#8217;s inventory &#8211; so I&#8217;ll add the <em>user_items</em> table:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> user_items <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	user_id int<span style="color: #66cc66;">,</span>
	item int<span style="color: #66cc66;">,</span>
	quantity int<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The design document mentions <em>&#8220;____ of holding&#8221;</em>&apos;s, which is something I haven&#8217;t quite figured out yet. I <strong>could</strong> just use a stat to keep track of the player&#8217;s current inventory limit, or I could come up with a better idea. For the moment, I&#8217;m going to leave this piece of functionality out of my database design &#8211; I&#8217;m not sure how to build it yet.(If you know a good way to do this, send me an e-mail at <a href='mailto:buildingbrowsergames@gmail.com'>buildingbrowsergames@gmail.com</a>, or comment on this blog post)</p>
<p>Based on the list of commands players can use, there are a few stats that I can add into the database right now:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Maximum Health'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'max_hp'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Health'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_hp'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Weapon'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_weapon'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Armor'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_armor'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Ring (Left Hand)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_ring_left'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Ring (Right Hand)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_ring_right'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Gold In Bank'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'bank_gc'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Gold In Hand'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'hand_gc'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Level'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_lvl'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Current Experience'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'cur_exp'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> stats<span style="color: #66cc66;">&#40;</span>display_name<span style="color: #66cc66;">,</span>short_name<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Experience to Next Level'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'next_exp'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>That sets me up with some of my starter stats, although it&#8217;s definitely not all of them &#8211; I&#8217;m sure I&#8217;ll end up adding more stats as Working Title grows into more of a finished product.</p>
<p>The last table that I&#8217;m going to add for now is simply for keeping track of exits off of rooms: <em>room_exits</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> room_exits <span style="color: #66cc66;">&#40;</span>
	id int <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	name text<span style="color: #66cc66;">,</span>
	from_room int<span style="color: #66cc66;">,</span>
	to_room int<span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span><span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>I&#8217;ll be tracking the <em>entity_id</em> of both of the rooms, and using the <em>name</em> value to select which exit. For example, an exit to the North from room 1 to 2 might look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> room_exits<span style="color: #66cc66;">&#40;</span>name<span style="color: #66cc66;">,</span>from_room<span style="color: #66cc66;">,</span>to_room<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'North'</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>With all this finished, there&#8217;s only one more system to add &#8211; spells. I&#8217;m not quite sure how I want to implement spells yet, either &#8211; do I want to have them do a set amount of damage, or base it on level, or something else? I&#8217;m going to hold off on designing any database tables for my spells system for now &#8211; once I have Working Title in a playable state, I&#8217;ll work on adding spells. For now though, I&#8217;m going to stick with what I have &#8211; I&#8217;ve got the basics of my database in place, and I can safely start developing now.</p>
]]></content:encoded>
			<wfw:commentRss>http://buildingbrowsergames.com/2008/07/14/diary-of-a-browsergame-setting-up-the-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

